What version of Node.JS are you using? As noted in Jimb's response, Chrome 
has changed this already. Also, you must remember that Node.JS is built on 
the Chrome V8 Javascript engine, not the Mozilla/Gecko JS engine. Anything 
that you do in a Mozilla browser cannot be translated perfectly to NodeJS. 

 

On Sunday, July 19, 2015 at 3:56:05 PM UTC-5, Robert Steckroth wrote:
>
> I need to override the length property of the Function constructor for a 
> wrapper I am making. Why does the following code work in Gecko and Mazilla 
> browsers but not nodejs?
>
> var f = function(a,b,c) {}
> f.length // = 3 <- length is three because 3 parameters are expected by 
> the function
>
> f.__defineGetter__("length", function() { return 5 })
> f.length // = 5 <- length is now five because f __proto__.length has been 
> overwritten with a property
>
> The above code works in the latest Chrome and Firefox but not in Nodejs, i 
> wonder why..
>
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/689470d6-e3f9-48dd-93e1-5de2f7b04c4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to