Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
console.log("--------常量--------");
const userName = "Mrs Wang";
console.log("userName:" + userName);
console.log("--------变量--------");
let testPath = {
uid: 1,
username: "test",
};
console.table(testPath);
console.log("-------命名函数-------");
function sum(a, b) {
return "a + b = " + (a + b);
}
console.log(sum(2, 3));
console.log("-------匿名函数-------");
const sum2 = function (a, b) {
return "a + b = " + (a + b);
};
console.log(sum2(2, 3));
console.log("-------箭头函数-------");
const sum3 = (a, b) => {
return "a + b = " + (a + b);
};
console.log(sum2(2, 3));
console.log("-------立即执行-------");
let sum4 = (function (a, b) {
return "a + b = " + (a + b);
})(2, 3);
console.log(sum4);