Running the following code in Node.js (via repl.it) gives inconsistent results:
function F() {}
F.__proto__ == Function.prototype
Why does this sometimes result in true and sometimes in false? Is there a correct answer?
Running the following code in Node.js (via repl.it) gives inconsistent results:
function F() {}
F.__proto__ == Function.prototype
Why does this sometimes result in true and sometimes in false? Is there a correct answer?
 
    
    function F() {} creates an object called F that is instanceof Function. This instance object has a prototype link to Function.prototype object. This link is not fixed, you can change prototype of an object after it's been created.
function F() {}
console.log('original F:', Object.getPrototypeOf(F) === Function.prototype);
Object.setPrototypeOf(F, {});
console.log('after prototype change:', Object.getPrototypeOf(F) === Function.prototype);