0

Can we declare below statement in js? This question was asked in interview.

Var undefined ;

16th Dec 2016, 6:40 PM
Dinakaran Balaji
Dinakaran Balaji - avatar
6 Antworten
0
A variable can be accessed before it's declaration. This concept is called variable hoisting
16th Dec 2016, 6:46 PM
Rishi Anand
Rishi Anand - avatar
0
Could you please explain me the use of variable hoisting?
16th Dec 2016, 6:52 PM
Dinakaran Balaji
Dinakaran Balaji - avatar
0
Well kid, as a matter of fact, I can. But you can do so yourself. Visit Mozilla Development Network, or just Google it.
16th Dec 2016, 6:54 PM
Rishi Anand
Rishi Anand - avatar
0
Thanks bro.
16th Dec 2016, 6:57 PM
Dinakaran Balaji
Dinakaran Balaji - avatar
0
my pleasure
16th Dec 2016, 6:58 PM
Rishi Anand
Rishi Anand - avatar
0
We can not declare any variable as undefined; example: var undefined=20; document.write(undefined); The output printed will be undefined but not 20; It means the variable declaration is not happening.
29th Dec 2016, 10:20 PM
chinni
chinni - avatar