0

I'm trying to understand the scope of variables in javascript when it comes to web-pages. For example, if I have let's say an index.html and I define two scripts

script One

var x = 2

script Two

var y = x

Would this work? Do both scripts work from a global pool of variables or are they each given their own space to work in?

TylerH
  • 20,816
  • 57
  • 73
  • 92
Eogcloud
  • 1,281
  • 3
  • 18
  • 42

0 Answers0