[removed] Two separate scripts - share variables?

前端 未结 5 1218
面向向阳花
面向向阳花 2020-12-08 10:21

If I have two separate scripts in an HTML page with JavaScript are the variables shared between the entire page? Or only within their own declarations?

Example:

5条回答
  •  心在旅途
    2020-12-08 10:59

    The window holds all variables. All scripts are in the mother window object. So all variables are in one space. They can, however, be localized to functions, etc.

提交回复
热议问题