JavaScript
Mi JavaScripts.
Variables
Declaring variables
For modern JavaScript:
letto declare a variable in modern JavaScript (ES6 or later)constfor values that must not change, or that you want to throw an error if they are changed.
For JavaScript before ES6:
var- to declare a variable in versions of JavaScript before ES6.varvariables do not have block scope.- They are scoped to the body of the containing function.
- If
varis used outside a function body, it declares a global variable.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| jQuery can’t find plugins: “TypeError: xxxxx is not a function” | jQuery is being loaded twice. | Remove the second jQuery. |