This link - http://javascript.crockford.com/private.html - says the following regarding private members in JavaScript:
Private
function Constructor(...) {
var that = this;
var membername = value;
function membername(...) {...}
}
Note: The function statement
function membername(...) {...}
is shorthand for
var membername = function membername(...) {...};
I thought about this, and tried the following: Instead of
var membername = function membername(...) {...};
I did just
var membername = function(...) {...};
and it seems to have the same effect.
Can anyone verify that these two are exactly the same in all cases? Do they only have the same privacy level/scope when used inside a function? What if they are just in the top-level definition of a JS file?
Thanks.