批改状态:合格
老师批语:
//常量(常量必须初始化/赋值)let a = "我是常量";console.log(a);// 变量// 声明变量并且初始化(变量可以不初始化,后面在赋值)let b = "我是变量";// 二次赋值console.log(b + "123");
let c = "全局作用域";console.log(c);{let c = "内部作用域";console.log(c);}·// 作用域权限由内而外!
// 3.标识符命名规则// 1.不能以数字开头,不能有特殊符号($和下划线除外)function test_$name(x, y) {return x + y;}console.log(test_$name(10, 30));// 驼峰式命名// GetName/getName// 蛇形命名// Get_Nmae
// 1.1命名函数function GetName(x, y) {return x - y;}console.log(GetName(10, 20));// 1.2匿名函数let sum = function (x, y) {return x - y;};console.log(GetName(10, 20));// 1.3箭头函数(去掉function,用旁箭头在大括号左边表示)let sum1 = (x, y) => {return x - y;};console.log(GetName(10, 20));
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号