Last Updated: February 25, 2016
·
328
· apelbaur

undefined object property

If you try to access a non-existing property of an object you'll get undefined:

var A = {};
console.log(A.a);//undefined
console.log(A);//Object {}

but you can put undefined as a member in the object

A.a = undefined;
console.log(A.a);//undefined
console.log(A);//Object {a: undefined}

note that it is still really undefined:

console.log(A.a===A.b);//true

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#javascript
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside