<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
//定义变量
var num = 1;
var num2 = 1.2;
var num3 = NaN;
var str = "abc";
var flag = true;
var obj = null;
var obj2 = undefined;a
// 输出到页面上
document.write(num + "<br>");
document.write(num2 + "<br>");
document.write(num3 + "<br>");
document.write(str + "<br>");
document.write(flag + "<br>");
document.write(obj + "<br>");
document.write(obj2 + "<br>");
</script>
</head>
<body>
</body>
</html>
Javascript 定义变量和输出
最新推荐文章于 2023-02-18 09:29:25 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)