function now(){
return +new Date;
}
questions :
new Date
but not new Date()
great thanks!
1 . The plus sign is the unary + operator.
That expression is equivalent to cast the Date object to number:
function now(){
return Number(new Date);
}
2 . If you don't add the parenthesis, the new operator will call the object type (Date) parameterlessly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With