``` window.onload = function(){
alert(abc);
}
//箭头函数
window.onload = ()=>{
alert("abc");
} // 如果只有一个参数圆括号可以省
let play = function(num){
alert(num*2); //24
}
play(12);
let play = num => {
alert(num*2); //100
}
play(50);
//如果只有一个return 花括号可以省
let move = function(e){
return e;
}
console.log(move(123)); //123
let move = num => num*2;
console.log(move(234)); //468
```
原文地址:https://www.cnblogs.com/lalalagq/p/10213508.html
时间: 2024-11-05 19:40:56