Skip to main content
Yiju Care GuidePreparing your page
医疗级专业核验
透明收费 · 拒绝隐形 Daily 08:00-20:00
News

Js箭头函数

Senior-care services, caregiving experience and industry updates for practical family reference.

Js箭头函数

ES5

 let show = function () {
            console.log("show");
            }
            show()

ES6箭头函数

 let show = () => {
            console.log("show");
        }
        show()
当形式参数只有一个的时候,可以省略()
 let arr = [1, 2, 3]
        arr.forEach(v => {
            console.log(v);
        })
当代码只有一句话的时候,可以省略{},自动返回,return可以不写
let arr2 = arr.map(v => v + 10)
        console.log(arr2);
Talk to an advisorBack to Home
Share Your Experience

Post a Comment

Reader Discussion

All Comments

0

No comments yet. Be the first to share your thoughts.