Javascript Array, String and Regexp Cheat Sheet: by Via
Javascript Array, String and Regexp Cheat Sheet: by Via
By literal way start Index at which to start changing the array. If greater than
[element0, element1, ..., elementN] the length, will set to length; if negative, will begin from the
new Array(element0, element1[, ...[, elementN]]) end.
new Array(arrayLength) dele‐ If 0, will not delete any element. If Omitted, will be equal to
By using the result of a math teC‐ length - start
ount
an array is returned by
- RegExp.exec item1, The elements to add to the array
- String.match item2
- String.replace returns an array containing the deleted elements
By using Methods These methods modify the array
Array.from(arrayLike[, mapFn[, thisArg]])
Array instance Accessor methods
an array-like object (object with a length property and indexed
elements, such as arguements) or iterable object (object where concat var new_array = old_array.concat( value1[, value2[, ...
you can get its elements, such as Map and Set). valueN]])
Every argument is considered as an element in the array. begin Zero-based. If negative, indicate an offset from
the end
Array.from and Array.of work like Array constructor to create
join str = arr.join([separator = ','])
an new array.
indexOf index = arr.indexOf(searchElement[, fromIndex = 0])
Array instance mutator methods lastIn‐ index = arr.indexOf(searchElement[, fromIndex =
copyWithin( target, start[, end = this.length]) dexOf arr.length - 1])
cheatography.com/amethystlei/
JavaScript Array, String and RegExp Cheat Sheet
by LeiQ (amethystlei) via cheatography.com/27322/cs/7820/
Array instance Iteration methods (cont) String instance methods unrelated to HTML
findIndex return the found Index or -1 concat str.concat( string2, string3[, ..., stringN])
Create a string
String literals
'string text'
"string text"
String( text)
`string text ${variable}` template strings
Create by Char codes
String.fromCharCode(num1[, ...[, numN]])
cheatography.com/amethystlei/
JavaScript Array, String and RegExp Cheat Sheet
by LeiQ (amethystlei) via cheatography.com/27322/cs/7820/
offset The offset of the matched substring within the whole string \xXX the Latin-1 character
cheatography.com/amethystlei/