JavaScript Cheat Sheet: Arrays, Functions, Objects & More
Classified in Computers
Written on in English with a size of 4.2 KB
JavaScript Cheat Sheet
JavaScript Arrays
var cars = ["Mercedes", "Tesla","Volvo"];
pop()
: Removes the last element of an array.push()
: Adds a new element at the end of an array.concat()
: Joins various arrays into a single array.reverse()
: Reverses the order of elements in an array.indexOf()
: Returns the first index of a given element in an array.lastIndexOf()
: Returns the last index of a given element in an array.join()
: Combines elements of an array into a single string.sort()
: Sorts array elements based on a condition.
Global Functions
These functions are built-in to every browser that runs JavaScript:
parseFloat()
: Parses the argument and returns a floating-point number.parseInt()
: Parses the argument and returns an integer.Number()
: Returns a