Quantcast
Channel: Comments on: Rethinking JavaScript Object Enumeration
Viewing all articles
Browse latest Browse all 14

By: Angus Croll

$
0
0

Hi and thanks for the compliment!

the right hand side of the first line is a function expression (FE) you haven’t actually assigned anything to b

It is really the same as saying
var a = function() {…}

(you are naming the FE ‘b’ but this is just annidentifier for the FE – it’s not assigned to anything.

To make typeof b return function you must either use a function declaration (FD)…

function b() {…};
var a = b;

…or use an explicit variable declaration…

var a = function(){…};
var b = a;

For more info see http://javascriptweblog.wordpress.com/2010/07/06/function-declarations-vs-function-expressions/

Hope this helps


Viewing all articles
Browse latest Browse all 14

Trending Articles