And ofcourse I want to do this code-wise. It's not that there isn't alternative to this problem I'm facing, just currious.
ah, it's so easy, thanks!
Khoi
2010-08-13 11:19:20
Note that exactly the same way you can check the existence of a key in an associative array (this is because usually objects **are** in fact associative arrays)
Andrea Zilio
2010-08-13 11:21:26
yes, it's just like in Python. I didn't know.
Khoi
2010-08-13 12:16:37
+1
A:
This will ignore attributes passed down through the prototype chain.
if(obj.hasOwnProperty('field'))
{
// Do something
}
Gary Chambers
2010-08-13 11:21:10