+ 19
JavaScript Hoisting!
Is this code valid? x = "Sololearn"; document.write(x); var x; The answer is yes because of the little known feature of JavaScript called hoisting. All declarations are moved to the top of the current scope. So, the last line is moved to the top and the code becomes valid. Check this out. https://code.sololearn.com/W6ih00m7yR96/?ref=app
4 Respuestas
+ 8
Ohh a new thing...Sir how about commenting it in the course !
Question:- Do the local scope variables also go in the top?
+ 6
Interesting stuff.
Was this described in the course at all? If not, it should be be!
+ 3
I didn't know that,really interesting!
+ 2
Thanks. Learnt this today. This is actually not a question but personal feed didn't exist 2 years ago, so the post is valid I guess.