xxxxxxxxxx
const names = ['Anthony','Jan','Joseph'];
names.push('Justin');
xxxxxxxxxx
const arr = [1, 2, 3, 4];
arr.push(5);
console.log(arr); // [1, 2, 3, 4, 5]
// another way
let arr = [1, 2, 3, 4];
arr = [arr, 5];
console.log(arr); // [1, 2, 3, 4, 5]
xxxxxxxxxx
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
xxxxxxxxxx
const sports = ['Football', 'Tennis']
sports.push('Basketball') // => ['Football', 'Tennis', 'Basketball']
xxxxxxxxxx
var arrayA = [1, 2];
var arrayB = [3, 4];
var newArray = arrayA.concat(arrayB);
xxxxxxxxxx
var s = new Set();
// Adding alues
s.add('hello');
s.add('world');
s.add('hello'); // already exists
// Removing values
s.delete('world');
var array = Array.from(s);