score:2

Accepted answer

the date object does not override the === operator, meaning that what is going to be compared is whether or not they have the same reference.

as a simple example, take the following code :

console.log(new date() === new date())

this is always going to return false no matter what because both created objects have a different reference.

however, you can use the string generated by formatting them as a key :

console.log((new date()).gettime() === (new date()).gettime())


Related Query

More Query from same tag