Maths

Date


stores a timestamp as ms elapsed from Jan 1, 1970.

new Date(0); //1 jan 1970 ; ms
new Date(-86400_000); //31 dec 1969
new Date("1995-03-25T13:33:55.383")
new Date(1995, 3, 25) //omitted set to 0

ms = Date.parse("Aug 9, 1995")

ti.setDate(feb_28.getDate() + 2) //mar 1 or mar 2 (auto-leap-check)
dt.setDate(0) //18 apr -> 31 march

Objects


Object.preventExtensions(obj) //no new props
Object.seal(obj) // no (+) (-) props , sets config-false for all
Object.freeze(obj) // seal and write-false all
Object.groupBy( T[], cb => key ) 

child = Object.create(proto, key_list)

dog.hasOwnProperty("legs")
"legs" in dog  // true if own or inherited

Array


Array.from(items, mapFn)
Array.fromAsync
Array.isArray(p)

fish = [1, ,3] //empty slot
array.entries() //get iterator
array.with(index, value) //create new array but T[i] = v 
array.indexOf(val, 3) //from i=3 ; can use -ve indices

//mutator methods
array.copyWithin(0, 3, 5) //copy item at index 3..4 to 0..1
array.splice(startIdx, 4,...newEle) //return deleted
sort, reverse

//utils
array.every(cb) array.some(cb)

Number


Number.MAX_VALUE; Number.MIN_VALUE; Number.POSITIVE_INFINITY; Number.NEGATIVE_INFINITY;

//Static methods
Number.parseInt(num, radix)
Number.toString(num, radix)
Number.parseFloat(num)
Number.isFinite(num)
Number.isInteger(num)

num.toFixed(2) // 2 decimals
num.toPrecision(3) //3 digits