批改状态:合格
老师批语:
let a = (a,b=0) =>a+b;console.log(a(8));输出结果为:8.若不设置默认参数b=0,则结果为NaN。
let a =(a,b,...c) =>console.log(a,b,c);console.log(a(1,2,3,4,5,6,7,8,9,10));输出结果为:1 2 (8) [3, 4, 5, 6, 7, 8, 9, 10]
let arr = [1, 2, 3, 4];console.log(...arr);输出结果为:1 2 3 4.
let fn = () =>[1,2,3,4];console.log(fn());输出结果为:(4) [1, 2, 3, 4]。
let fn = () =>({id:1,user:"新手1314",age:20,})console.log(fn());输出结果为:{id: 1, user: '新手1314', age: 20}
引号:let name = "新手1314”;console.log("hello " + name); 输出结果为:hello 新手1314反引号:let name = "新手1314";console.log(`hello ${name}`); 输出结果为:hello 新手1314
user`id: ${1} user: ${"新手1314"}`;function user(strings, ...args){console.log(strings);console.log(args);console.log("id: " + args[0] + ",名字: " + args[1]);}输出分别为:(3) ['id: ', ' user: ', '', raw: Array(3)](2) [1, '新手1314']id: 1,名字:新手1314
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号