Skip to content

Instantly share code, notes, and snippets.

@franzese
Last active May 2, 2019 23:23
Show Gist options
  • Save franzese/b4353a05d4e4d39f516a20d7c26c25dc to your computer and use it in GitHub Desktop.
Save franzese/b4353a05d4e4d39f516a20d7c26c25dc to your computer and use it in GitHub Desktop.
/*************************
Array Cheatsheet
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Browser_compatibility
**************************/
let tmp1 = []; // "literal notation"
let tmp2 = new Array(); // potentially could be overwritten
let tmp3 = [5]; // [5] - length is 1
let tmp4 = [1, 2, 3]; // [1, 2, 3] - length is 3
let tmp5 = new Array(3); // [undefined, undefined, undefined]
// Properties
Array.length;
// MethodsArray.concat(); //
Array.copyWithin(); //
Array.entries(); //
Array.every(); //
Array.fill(); //
Array.filter(); //
Array.find(); //
Array.findIndex(); //
Array.flat(); //
Array.flatMap(); //
Array.forEach(); //
Array.from(); //
Array.includes(); //
Array.indexOf(); //
Array.isArray(); //
Array.join(); //
Array.keys(); //
Array.lastIndexOf(); //
Array.length; //
Array.map(); //
Array.of(); //
Array.pop(); //
Array.prototype(); //
Array.push(); //
Array.reduce(); //
Array.reduceRight(); //
Array.reverse(); //
Array.shift(); //
Array.slice(); //
Array.some(); //
Array.sort(); //
Array.splice(); //
Array.toLocaleString(); //
Array.toString(); //
Array.unshift(); //
Array.values(); //
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment