Correcting teacher:天蓬老师
Correction status:qualified
Teacher's comments:
<button onclick="alert('nihao')">a</button>
<button onclick="btn()">a</button>
<script>
function btnClick() {
onclick = alert('nihao');
}
</script>
function btnClick() {
onclick = alert('nihao')
}
let
来声明变量
let btn = '1';
const
来声明常量
const btn = '1';
// function +函数名 +() +{}
let name = function () {}
function demo() {
return function () {
return 'nihao'
}
}
console.log(demo());
sum = function (...arr) {
return arr.reduce((p, c) => p + c);
}
=>
sum = a => a + 10;
console.log(sum(10));
(function (a, b) {
console.log(a + b);
})(10, 20)