loading
open in
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Date object instance
var today = new Date();
//today is a full-fledged object that can leverage methods from the Date data type
console.log(today);
console.log(today.getFullYear());
console.log(today.getDate());
console.log(today.toLocaleDateString("en-US"));


// Date type also has the static now() method which can be called without new  
var todayStatic = Date.now();

// todayStatic is a plain timestamp (static) value, with no access to other methods
console.log(todayStatic);

// Math data type is composed of all static properties and methods 
// new is never used since values don't change based on an object instance 
console.log(Math.PI);
console.log(Math.pow(2,2));

var square = Math.pow(2, 3);
console.log(square);
Native Browser JavaScript