0

I am seeing this ES6 syntax around the web recently:

let queriedAt = +new Date();

What does the +new do?

seantomburke
  • 10,514
  • 3
  • 18
  • 23
  • `+` is just the unary plus operator. It serves the purpose of converting the Date object into a number (a timestamp). Try it on the console, with and without the plus. – Margaret Bloom Feb 27 '16 at 08:14
  • To clarify, the plus is executed against `new Date()` variable, not the `new` keyword. The duplicate answer should explain the rest – CodingIntrigue Feb 27 '16 at 08:15

0 Answers0