Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // array ops
- var arr = [];
- arr.push();
- arr.unshift();
- arr.pop(); // stack
- arr.shift(); // queue
- //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
- arr = arr.concat(arr2); // combine
- arr.slice(1);
- arr.splice(1,0,item);
- arr.join(“‘”);
- //
- arr.includes() // true
- arr.indexOf();
- arr.reverse();
- arr.sort();
- arr.sort(compare);
- function compare(a,b) {
- if a.prop < b.prop return -1
- else if b.prop < a.prop return 1
- else return 0
- }
- function compare(a,b) {
- return a -b
- }
- var d2m3x = [
- [1,2,3],
- [4,5,6],
- [7,8,9]
- ];
- var d3m3x = [
- [
- [1,2,3],
- [4,5,6],
- [7,8,9]
- ],
- [
- [1,2,3],
- [4,5,6],
- [7,8,9]
- ],
- [
- [1,2,3],
- [4,5,6],
- [7,8,9]
- ]
- ];
- // string ops
- slice()
- substr()
- replace();
- replaceAll();
- concat();
- trim();
- indexOf();
- charAt();
- split();
- includes();
- startsWith();
- toLowerCase()
- toUpperCase();
- // match ops
- +
- -
- *
- /
- %
- ** x**y == Math.pow(x,y)
- Math.sqrt(x)
- Math.pow(25, 1/2) = 5
- Math.pow(n, 1/root)
- –
- ++
- toFixed(2); // two decimal places
- Number(‘3’); // parse to numb
- parseInt();
- parseFloat();
- Math.round();
- Math.ceil();
- Math.floor();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement