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,799
  • 66
  • 75
  • 101
Eogcloud
  • 1,335
  • 4
  • 19
  • 44

0 Answers0