Javascript : functions without prototype -


built-in functions in javascript (e.g. object.keys) don't have "prototype" property.

object.keys.prototype === undefined;             // returns true array.prototype.slice.prototype === undefined;   // returns true 

however, either function(){...} or new function() generate constructor (instance of function) along prototype (instance of object). isn't expensive?

is possible create a pure function instead of constructor in javascript?

the question "what 'creating' them mean"?

for intent , purpose,

function myfunc ( ) { }  myfunc.constructor = undefined; myfunc.prototype = undefined; 

will want, practical standpoint.

in es6, lambdas should have no ties other functions;

(() => { }).prototype === undefined; // believe should 100% true 

...your other question... ...is expensive there added functions/objects created each function...

....well, there games running happily on browsers. talking memory consumption making functions typically immeasurably small, these days (though iot / wearables concern).
that's premature micro-optimization.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -