function buttonPress()
{
var userInput=document.getElementById('userInput');
alert(userInput.value);
}
I removed
`var userInput=document.getElementById('userInput');`
and was left with
`alert(userInput.value);`
but the output did not change at all it was left the same, userInput
is not even declared but it works.
I cleaned all the data from browser,restarted the server, but result did not change, my brain is exploding, could it be because I am using the same name for id and the var?
In JavaScript, variables that are assigned a value but not declared are implicitly declared as a global variable.