6、JS的变量

yu
yu
2024-10-04 / 0 评论 / 6 阅读 / 正在检测是否收录...
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>变量</title>
    <script>
        // var x //定义变量不赋值

        // x = 100 //从输入框内获取

        // var y = x + 2000 //定义变量赋值
        // console.log(y)
        
        // var x,y,z

        // var a=1,b=2,c=3
        // // 括号中加双引号是变量,不加是字符



        // let age 
        // // 赋值 = 赋值
        // age = 18
        // // 输出age变量
        // console.log(age)

        // let age = 18, uname = "kunkun"
        // console.log(age,uname);
        // 提倡声明的方式
        let age = 17
        let uname = "kun" 
        console.log(age,uname)


        
    </script>
</head>
<body>
    
</body>
</html> 
0

评论 (0)

取消