DEV Community


Discussion on: JavaScript Interview Question #49: Add a new array element by index

coderslang profile image
Coderslang: Become a Software Engineer Author

Great comment! The original question is not about teaching beginners "how to", but rather about explaining the situation "what if".

And the best way to add a new element to the end of the JS array is by using a push method.