Function Name in Arrow Functions in JavaScript

in #technology7 years ago

The function name is an important bit of information, especially for debugging. But, how is it determined in arrow function syntax?

For normal functions, function name is clearly stated in function declarations:

    function doSomething() {
        // body code
    }

Even for function expressions, you can supply a function name to make debugging easier:

    var f = function doSomething() {
        // body code
    };

Arrow functions do not use the function keyword and you cannot include a function name. But since they are essentially used in expressions, the left-hand side variable name is assigned to the resultant function as the function's name property.

    let doSomething = () => {
        // body code
    };

This is the standard behavior according to the specification.

Sort:  

Very Educative. How is it useful in steemit tools? Is there any simple tool to develop steemit promotional app in Kiswahali? Kiswahili is my mother tongue.

Some small but effective knowledge.
thanks

I have no idea....what I am reading! My poor brain...

sir have u any group for steemit upvote?

I think you need something like @steemtrail .

This post has received a 6.98 % upvote from @buildawhale thanks to: @ghasemkiani. Send at least 0.50 SBD to @buildawhale with a post link in the memo field for a portion of the next vote.

To support our curation initiative, please vote on my owner, @themarkymark, as a Steem Witness

This post has received a 2.39 % upvote from @booster thanks to: @ghasemkiani.

Thanks for the awesome post.
upvote & comment...