Pearl App
arr.push(..element) adds a new element to the end of an array and returns the new length of the array. arr.push() method mutates the original array.
arrName.push(element1,element2,…)
The call arr.push(...) is equal to arr[arr.length] = ...
2. Poparr.pop() method removes an element from the end of an array and returns the removed array. This method also changes the original array and it’s length.
arrayName.pop()
3. Shiftarr.shift() method removes the first element from an array and and returns the extracted element. This method is also changes the length of the original array.
arrName.shift()
4. Unshiftarr.unshift(elements) method adds one or more element at the beginning of an array and returns the new length of the array.
arrName.unshift(item1, item2,….)
5. Splicearr.splice() method change the original array by inserting, removing, and replacing elements.
//Syntex array.splice(start[,deleteCount[, item1[, item2[, ...]]]])Starting from the index
0
it removed
1
element.
remove and replace
6. Slicearr.slice() method selects a portion of an array and returns a new array copying to it all items from index start to end. The original array does not change.
returns a shallow copy of a portion of an array.
7. Includesmethod looks for item starting from index given and returns true if found otherwise returns false.
return value: true/false.
8. forEach (Iterate)9. Joinmethod creates a string of array items by concatenating all the elements of an array. They are separated by commas or any other given separator (/, — , +, ).
return value: string.
10. toStringtoString() method converts an array to a string and returns string as a result.
return a string value.
Pearl Apps Terms and conditions / Privacy Policy