批改状态:合格
老师批语:
null、undefined、number、string、boolean
ES6是新引入的原始数据类型,表示独一无二的值,不常用。
Object、Array、Date、Function,…
function name() {}
cosnt name = fucntion (){}
cosnt name = () => {}
function name(...args) {};作用域是单向的,由外向内传递可以,由内向外不可以
闭包函数示例:
const countTo = ((a) => {return () => a++;})(300);console.log(countTo)); // 300console.log(countTo)); // 301
const x = 30;const y = 5;console.log(x+'-'+y+'='+(x-y));

const x = 30;const y = 5;console.log(`${x}-${y}=${x-y}`);

console.log`bread ${5} ${25} ${125} cake`;

function total(strings, ...args) {let res = `${strings[0]}:${args.join()}乘积${args.reduce((x, y)=>x*y)}`;console.log(res);}total`hello${21}${10}${9}${27}`;

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号