I need help in JavaScript


#1

I am on the SEARCH TEXT FOR YOUR NAME 5 in JavaScript but I am not understanding:

newArray = [];
newArray.push('hello');
newArray[0]; // equals 'hello'

I especially do not understand the .push command. Thanks for helping me out on this.


#2

If you've ever worked with Python, you'll remember the .append() function. The .push() function is quite similar. Both, when called on an array or list, will add the object placed in the parameters list into the list, at the end of the list. So, in this case, you have an empty array, so when you .push() the word "hello" onto it, it adds it onto the end of this list, in this case the 0th index.