How do I write a named arrow function in ES2015?

前端 未结 8 898
余生分开走
余生分开走 2020-11-22 16:29

I have a function that I am trying to convert to the new arrow syntax in ES6. It is a named function:

function sayHello(name) {
    console         


        
8条回答
  •  再見小時候
    2020-11-22 16:59

    THIS IS ES6

    Yeah I think what you're after is something like this:

    const foo = (depth) => {console.log("hi i'm Adele")}
    foo -> // the function itself
    foo() -> // "hi i'm Adele"
    

提交回复
热议问题