Saturday, December 8, 2018

Drawback of function Expression

function foo() { ... }
Because of function hoisting, the function declared this way can be called both after and before the definition.

Function Expression

  1. Named Function Expression
    var foo = function bar() { ... }
  2. Anonymous Function Expression
    var foo = function() { ... }
foo() can be called only after creation.

No comments:

Followers

Link