Array.SPLICE method Flashcards
1
Q
const numbersa = [1,2,3,4,5,6];
delete numbersa[2];
console.log(…numbersa);
A
Array [1, 2, undefined, 4, 5, 6];
2
Q
what are the 3 parameters of splice?
A
start index
delete count
item: elements to add
3
Q
const numbersa = [1,2,3,4,5,6];
numbersa. splice(1,0,”hello”);
console. log(numbersa); //
A
[1, “hello”, 2, 3, 4, 5, 6]
4
Q
const numbersa = [1,2,3,4,5,6];
numbersa. splice(1,1);
console. log(numbersa);
A
[1, 3, 4, 5, 6]