Is there there a difference between these two variable declarations?
var answer;
var answer = " ";
I look forward to a response from anyone. Thank you.
Is there there a difference between these two variable declarations?
var answer;
var answer = " ";
I look forward to a response from anyone. Thank you.
The first declaration gives answer a value of undefined.
The second declaration (initialization) assigns answer a space character for a value.
The first one is a null initial value. (correction: undefined)
The second one is a string, albeit empty string.
Ok. I get it. Thanks.
The question looks trivial. I am a newbie in javascript - still coming up. Thanks for the response though. This is clear now.