Skip to content

Variable cannot accessed from a closure function called from setTimeout. #10

@jingwood

Description

@jingwood

Variable cannot accessed from a closure function called from setTimeout.

Related to #1

function abc() {
  var b = 20;
  
  return (function(){
    setTimeout(_ => console.log("b = " + b), 1000);
  })();
}

abc();

Current result

b = undefined

Expected result

b = 20

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions