Basic array operations in Javascript
How to add elements at the start of an array in javascript? let list1 = [‘b’, ‘c’]; //using spread operator console.log([‘a’, …list1]); //Or using unshift method list1.unshift(‘a’); console.log(list1); How to add elements at the end of an array in javascript? let list2 = [‘a’, ‘b’]; //using spread operator console.log([…list2, ‘c’]); //or push method list2.push(‘c’); console.log(list2); […]
Basic array operations in Javascript Read More »