Horje
adding to an array without mutating the original array Code Example
adding to an array without mutating the original array
// since we will not be mutating, 
// use const
const arr1 = ['a', 'b', 'c', 'd', 'e'];

const arr2 = [...arr1, 'f']; // ['a', 'b', 'c', 'd', 'e', 'f']
const arr3 = ['z', ...arr1]; // ['z', 'a', 'b', 'c', 'd', 'e']




Javascript

Related
router.push next js Code Example router.push next js Code Example
javascript icon Code Example javascript icon Code Example
Node-Red: 2Outputs Code Example Node-Red: 2Outputs Code Example
how to write a program that alerts the first 3 letters of the current day in javascript Code Example how to write a program that alerts the first 3 letters of the current day in javascript Code Example
Search specific products in the array in javascript Code Example Search specific products in the array in javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8