Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 606 Bytes

using-global-variables.md

File metadata and controls

16 lines (11 loc) · 606 Bytes
id title
using-global-variables
Using Global Variables

When you include a script in the HTML file that defines global variables and try to use one of these variables in the code, the linter will complain because it cannot see the definition of the variable.

You can avoid this by reading the global variable explicitly from the window object, for example:

const $ = window.$;

This makes it obvious you are using a global variable intentionally rather than because of a typo.

Alternatively, you can force the linter to ignore any line by adding // eslint-disable-line after it.