Last Updated: February 25, 2016
·
1.102K
· brandturner

Eloquent JS Objects

The operator in can be used to test whether an object has a certain property. For example:

var chineseBox = {};
chineseBox.content = chineseBox;
console.log("content" in chineseBox); // TRUE
console.log('content" in chineseBox.content); //TRUE

Setting one object equal to another just creates a reference to that object. When one object is updated, so is the other since it is a reference and now the creation of a new object.
To test two different dates, you need to test their time values. So: wallFall1.getTime() == wallFall2.getTime();

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