Timestamps, .now( ), and .valueOf ( )
Video
JavaScript Notes
JavaScript
// datenow.js
// Date.now( ) vs. date.valueOf( )
// Jan 1, 1970, 12:00:00
// number of milliseconds that has passed
log = console.log;
let timestamp1 = Date.now( ); // class method, static method
log (timestamp1);
let today = new Date( ); // using the constructor method
let timestamp2 = today.valueOf( ); // instance method (working on instance of object)
log(timestamp2);
Feedback
Submit and view feedback