What value will window.a have after the following script finishes

if ( !('a' in window) ) {
  var a = 1
}
Explanation
Because variable initialisation comes higher than current visibility the code equals the following:

var a
if ( !('a' in window) ) {
  a = 1
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes