Skip to content

I think arrow functions create closures #73

@jameshbush

Description

@jameshbush

The section Lexical Scoping https://ponyfoo.com/books/practical-modern-javascript/chapters/2#lexical-scoping-8zsxfqh9
claims that arrow functions don't create closures. It looks like they do. In fact, the code relies on closure of arguments in the evaluation of the returned function. I think this should say "arrow functions don't create their own lexical scope, so arguments is accessed from the closure of the enclosing function".

calc=((a)=>( (b)=>{debugger; return a+b} ))(a=1); calc(2)

Screen Shot 2019-06-15 at 15 08 04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions