I am new to javascript and i have tried one example today, can someone help me to explain why?
all test are done on console panel from Chrome:
var greetingHello = "Hello";
var name = prompt("please enter your name");
document.write(greetingHello + " " + name + "<br>");
var name = new Array("name1","name2","name3");
document.write(name[0]);
The result is n
But if i change the second "name" variable from "name" to "myName", and executed myName[0]
the result is "name1"
Why is it so strange?