๐ฐnamed function expression
๐ง ๆฝๅทฅไธญ
Last updated
Was this helpful?
๐ง ๆฝๅทฅไธญ
Last updated
Was this helpful?
Was this helpful?
JS โฉ value โฉ function โฉ expression โฉ named
replit๏ผnamed function expression
outerName
is in the outer scope
innerName
is in the inner "implied scope".
// โญ named function expression
// ------------------------------------
// โญโโnameโโโฎ
var outerName = function innerName() {
console.log(innerName);
// ^^^^^^^^^ <---- โญ visible from inside
};
outerName(); // [Function: innerName]
outerName.name, // "innerName"
innerName, // โ ReferenceError: `innerName` is not defined
// (โญ `innerName` invisible from outside)