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];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are the 3 parameters of splice?

A

start index
delete count
item: elements to add

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

const numbersa = [1,2,3,4,5,6];

numbersa. splice(1,1);
console. log(numbersa);

A

[1, 3, 4, 5, 6]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly