Show Menu
Cheatography

JavaScript Cheat Sheet (DRAFT) by

JavaScript Cheat Sheet for interview

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

Rest Operator

 function myBio(­fir­stName, lastName, ...oth­erInfo) { 

  return otherInfo;

} 

myBio(­"­Olu­wat­obi­", "­Sof­ela­", "­Cod­eSw­eet­ly", "Web Develo­per­", "­Mal­e");


// The invocation above will return:
["Co­deS­wee­tly­", "Web Develo­per­", "­Mal­e"]

Rest Operator (copy)

// Define a function with two regular parameters and one rest parameter:
function myBio(firstName, lastName, ...otherInfo) { 
  return otherInfo;
}

// Invoke myBio function while passing five arguments to its parameters:
myBio("Oluwatobi", "Sofela", "CodeSweetly", "Web Developer", "Male");

// The invocation above will return:
["CodeSweetly", "Web Developer", "Male"]