A
A
anastaciaigel2015-11-26 08:59:02
JavaScript
anastaciaigel, 2015-11-26 08:59:02

How to understand how JavaScript object comparison works?

The comparison of objects is not entirely clear. Why d == d1 produces false is understandable. Different objects, different links. But in other cases, I can't figure it out. Tell me please.
var d= new Date();
var d1= new Date(d.getTime());
console.log(d>=d1); // true
console. log(d> d1); // false
console. log(d== d1); // false

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2015-11-26
@anastaciaigel

Read about type conversion https://learn.javascript.ru/types-conversion

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question