+ 2

Why my array is not work correctly?

It's given the first letter and not the first word... https://code.sololearn.com/WC8Kzs6RgEpX/?ref=app

15th Jul 2019, 9:46 AM
arieh
3 Respuestas
+ 6
arieh The reason you are getting just the letter of the name is that name is a property of the global object. A getter and setter to be exact. The getter returns a string, hence the reason for just the first letter of the string. To prove this for yourself add console.log(window.name) to the end of your code. https://code.sololearn.com/WB7BGaIY4r74/#html
15th Jul 2019, 10:17 AM
ODLNT
ODLNT - avatar
+ 3
var courses = ["HTML", "CSS", "JS"]; document.write(courses[2]); var names = new Array("Arieh", "yeshoua"); document.write (names[0]); This works fine
15th Jul 2019, 10:00 AM
deeyae
deeyae - avatar
+ 3
Thank you.
15th Jul 2019, 1:13 PM
arieh