I think it is just showing that there are three ways to make a mutative change to an array, each line does the same thing.
array.push('π΄') simply adds to the end of the array array.splice(array.length, 0, 'π΄') removes 0 items from the end of the array, and adds one item array[array.length] = 'π΄' adds an item to a specific position, which in this case is at the end of the array
What's the point of these two lines?
Pretty sure
array.push('π΄');
already gets the job done.I think it is just showing that there are three ways to make a mutative change to an array, each line does the same thing.
array.push('π΄')
simply adds to the end of the arrayarray.splice(array.length, 0, 'π΄')
removes 0 items from the end of the array, and adds one itemarray[array.length] = 'π΄'
adds an item to a specific position, which in this case is at the end of the arrayyes, that's what I'm trying to do, thanks for clarifying Luis!
Aleksandr, I see how's that can be confusing...maybe i should fix it up π€
Ah, yep, I thought it was all being executed sequentially