Show Menu
Cheatography

JS Cheat Sheet (DRAFT) by

js cheatsheet to study

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

Objects

Getting the value
studen­­t.f­­i­rs­­tName
or

studen­­t[­"­f­i­rs­­tNa­­me­"]
Setting the value
studen­­t.i­­s­Sm­­art­­=true
Calling an object method
studen­­t.f­­u­ll­­Name()
Delete
delete object­[key]
Reassign Property Value
object­["pr­ope­rty­"] = "new value"

Math

Odd Number
if (num % 2 == 1) { 
  return true; }
Even Number
if (num % 2 == 0) { 
  return true; }
 

Functions

 
 

Arrays

substr­ing()
str.su­­bs­t­r­in­­g(i­­nd­e­x­Start, indexEnd)
const test ='ABCDEFG'  / test.s­ubs­tri­ng(2,4) -> 'CD'
slice()
str.sl­­ic­e­(­be­­gin­­Index, endIndex)
charAt()
str.ch­­ar­A­t­(i­­ndex)
const test = 'ABCD'; 
const index = 0;
consol­e.l­og(­"­Index ${index} is ${test.ch­arA­t(i­nde­x)}­");
// expected output: "­Index 0 is A"