+ 2
Imagine you have an empty JavaScript array (list=[ ]), If you insert 9 in position 0, 3 in position 1, and then 8 in position 0
Imagine you have an empty JavaScript array (list=[ ]), If you insert 9 in position 0, 3 in position 1, and then 8 in position 0 again, what do you get when you print the list to the console ?
2 Respostas
+ 4
list = []
list[0] = 9 //list = [9]
list[1] = 3 // list = [9, 3]
list[0] = 8 //list = [8, 3]
Inserting items at specific position this way replaces the previous element present in that position from the array with the new one.
0
i think
[9, 3, 8]
oops i read bad
sorry