javascript - What is 1 * new Date()? -
reading through jquery source code , have come across following line of code:
1 * new date() following google search, have seen included in google analytics snippet.
can explain happening here, , purpose of line?
generate random number not repeated again?
new date() return date() object.
when coerced string object returns iso formatted string interpretation of date:
console.log(new date()); // = 'thu mar 17 2016 09:37:12 gmt+0000 (gmt)' when coerced integer return epoch timestamp of date:
console.log(1* new date()); // = 1458207432249 note coercion int returns same value date.now(), that method not available in ie8 , older.
Comments
Post a Comment