I don't understand what's going on here. If I do this:
function foo() {
return 'hey there';
}
foo.value = 'some random value';
console.log(foo.value) // 'some random value';
console.log(typeof foo) // 'function'
console.log(foo) // ƒ foot()...
I can access later foo.value
without problem but if I do typeof foo
it returns function
.
Where is foo.value
being stored. Is definitely not in the global object. Can a function store properties then?