Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
function hello1(name,...users){
// return 'hello,' + username;
console.log(name);
return users;
}
console.log(hello1('测试' , '没说' , '不说'));
function hello2(...users){
// return 'hello,' + username;
console.log(name);
return users;
}
const arr = ['测试1' , '没说2' , '不说3'];
console.log(hello2(...arr));
let username = '12测试';
console.log(`hello ${username}`);
function total (strings, ...args){
console.log(strings);
console.log(args);
}
let name = '手机';
let num = 10;
let price = 500;
total `名称:${name},数量:${num},单价:${price}`;
fn = function(a){
return function(b){
return function (c){
return function(d) {
return a + b + c + d;
};
};
};
};
纯函数就是可以将外部的自由变量,通过传参的方式到函数中,不用直接在函数中来使用
let x = 0.5;
function getPrices(price,x){
return price * x;
}
console.log(getPrices(1000,x));