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 

working example

note coercion int returns same value date.now(), that method not available in ie8 , older.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -