1.没有int char等类型,统一用var
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
var a;
a=1;
document.write(a);
</script>
</head>
<body>
</body>
</html>
2.函数:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function show(a)
{
document.write(a);
}
show(1);
</script>
</head>
<body>
</body>
</html>
3.对象:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
var x=new Object(); //Object第一个字母注意大写
x.name=6;
function show(a)
{
alert(a);
}
show(x.name)
</script>
</head>
<body>
</body>
</html>