Show Menu
Cheatography

Javascript for Interviews Cheat Sheet (DRAFT) by

Javascript for interviews, quick refresher of the things that are often use in DSA style interviews

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Arrays

a1.pus­h(obj)
Add obj to end of array a1, return length
a1.pop()
Remove and return last
a1.rev­erse()
a1.sli­ce(­start, end)
a1.for­Eac­h(fn)
a1.con­cat(a2)
a1.eve­ry(fn => bool)
a1.some(fn => bool)
a1.sort() / a1.toS­orted()
Sort in place / non destru­ctive
a1.unshift
Add to start of array
Array.i­sA­rra­y(var)
Return true if var is array
 

Objects

Object.en­tri­es(obj)
Return array of objects [k, v] pairs
Object.fr­omE­ntr­ies(a1)
Create object from [k, v] pairs
Object.is­(va­lue1, value2)
True if same instance (not deep)