Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Improved title/wording
Source Link
Steve Chambers
  • 39.8k
  • 29
  • 179
  • 222

Difference between variable declaration syntaxes in Javascript (including global variables)?

isIs there any difference between declaring a variable:

var a=0;//1

and this...this way:

a=0;//2

or...or:

window.a=0;//3

in global scope?

Javascript global variables

is there any difference between declaring a variable

var a=0;//1

and this way

a=0;//2

or

window.a=0;//3

in global scope?

Difference between variable declaration syntaxes in Javascript (including global variables)?

Is there any difference between declaring a variable:

var a=0;//1

...this way:

a=0;//2

...or:

window.a=0;//3

in global scope?

Notice removed Reward existing answer by Community Bot
Bounty Ended with no winning answer by Community Bot
Notice added Reward existing answer by Michelle Smith
Bounty Started worth 100 reputation by Michelle Smith
Source Link
Dan
  • 58.2k
  • 44
  • 125
  • 162

Javascript global variables

is there any difference between declaring a variable

var a=0;//1

and this way

a=0;//2

or

window.a=0;//3

in global scope?

lang-js

AltStyle によって変換されたページ (->オリジナル) /