var s=+newDate();
The explanation is as follows:=+ does not exist;
+new Date() is a thing;
+ is equivalent to .valueOf();
I'll add it after seeing the reply.getTime() also gets the number of milliseconds
//The same 4 results return the number of milliseconds of the current time
alert(+new Date());
alert(+new Date);
var s=new Date();
alert(());
alert(());
Various usages of js to obtain time:
https:///article/
var myDate = new Date();
var a=( );
2011-11-07 18:13:56
By the way, another usage of valueOf:
The valueOf() method returns the original value of the Boolean object.
If the object calling the method is not Boolean, an exception TypeError is thrown.
var boo = new Boolean(false);
(());
Other usages:https:///w3school/js/jsref_valueof_math.htm
The explanation is as follows:=+ does not exist;
+new Date() is a thing;
+ is equivalent to .valueOf();
I'll add it after seeing the reply.getTime() also gets the number of milliseconds
Copy the codeThe code is as follows:
//The same 4 results return the number of milliseconds of the current time
alert(+new Date());
alert(+new Date);
var s=new Date();
alert(());
alert(());
Various usages of js to obtain time:
https:///article/
Copy the codeThe code is as follows:
var myDate = new Date();
var a=( );
2011-11-07 18:13:56
By the way, another usage of valueOf:
The valueOf() method returns the original value of the Boolean object.
If the object calling the method is not Boolean, an exception TypeError is thrown.
Copy the codeThe code is as follows:
var boo = new Boolean(false);
(());
Other usages:https:///w3school/js/jsref_valueof_math.htm