for (var key in myobj) must be accompanied with
if(Object.hasOwnProperty.call(myobj,key))
example:
for (var key in myobject) {
if(Object.hasOwnProperty.call(myobject,key)){
...
}
}
myobject.forEach(function(){...}) already does this.
more:
You could do : myobj.hasOwnProperty(key) But then if myobj is NULL it
will throw an error.
So you use the method hasOwnProperty from the prototype object.
and you call it with changing the this object of it to your object.
Object.hasOwnProperty.call(myobj,key)
Most of you probably know this, but sometimes I encounter modules that
don't do this.
And they do unexpected errors.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en