批改状态:合格
老师批语:
//数据类型let gende; //未初始化变量的默认值 undeifnedlet age = 10; //整数let num = 1.11; //小数let name = "DDDD"; //字符串let isMarr = true; //布尔//符号,创建对象属性的唯一标识let s Symbol('custom symbol');console.log(s,typeof s);//使用typeof 检测数据类型console.log(age,typeof age);//字符串拼接使用”+“号console.log('邮箱' + email);//值传递let a = 100;// 将变量的a的值,传递到了b;let b = a;console.log(b);let a = 200;console.log(b);// a的更新不会影响到b//对象字面量let user = {// 属性,相当于变量id:1,name:'zhangzhongguo','my email':'123456@qq.con',// 方法:函数getName:function(){//this表示当前的上下文,当前对象return '我的名字叫:'+ this.name;}}console.log(user.id,user.name);console.log(user['my email']);console.log(user.getName());//数组let course = [5,'javascript','php.cn'];//访问数组中的第二个值console.log(course[1]);//函数function hello(){}console.log(hello,typeof hello);console.log(hello,instanceof Object);// 对象是属性的无序集合,对象可以添加属性hello.email = '123456@qq.com';console.log(hello.email);
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号