每天进步一点点,坚持就是胜利,加油~~~
箭头函数:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>箭头函数</title>
<script>
// 普通函数
function(){}
window.onload = function(){
alert('abc')
}
//箭头函数
()=>{}
window.onload = ()=>{
alert('def')
}
</script>
</head>
<body>
</body>
</html>
1:如果只有一个参数,()可以省
let show = a =>{}
2:如果只有一个return, {}可以省
let show = (a,b) => a*2