批改状态:合格
老师批语:
作业标题:0707作业
作业内容:
变量,常量,数据类型,实例演示
<!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></head><body><!-- 常量 --><script>const TEST = "abcd";console.log(TEST);// 变量let userName = "张老师";console.log(userName);//基本数据类型 数值型let name = 10;console.log(typeof name);//字符型userName = "张老师";console.log(typeof userName);//布尔型let test = true;console.log(typeof test);//undefined型let test1;console.log(typeof test1);//null型let test2 = null;console.log(typeof test2);//引入型数据类型//数组const test3 = [1, 2, 3, 4, 5];console.log(typeof test3);//对象const test4 = { id: 002, userName: "张三" };console.log(typeof test4);//函数function test5() {return console("aaa");}console.log(typeof test5);</script></body></html>
函数参数与返回值,匿名函数及箭头函数的转化
代码
<!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></head><body><script>// 函数参数与返回值function student(a, b) {return a + b;}console.log(student(40, 50));// 匿名函数let sum = function (a, b) {return a + b;};console.log(sum(30, 50));//箭头函数let sum1 = (a, b) => a + b;console.log(sum1(10, 60));</script></body></html>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号