Can anyone explain this ?
I read that functions are just an object in Javascript just that is callable . I.e a function is a subset of object (hashmaps) .
However an object is created using function like this
function Constructor() {}; a = new Constructor();
a = {} ; //a.constructor is the 'Object' Function
//And Douglas Crockfords Object.create(a) does this
Object.create = function(obj){
function F();
F.prototype = obj;
return new F();
}
So the question is that if an object itself is created from a function , how can it be the superset ? I am sure my logical reason is failing somewhere but not quite clear as to what is it that I fail to understand ! Feels like a bit of Chicken and Egg problem . Can anyone help with my logical fallacy ?
PS: This question's essence has something to do with this What is a metaclass in Python?