This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.



Smartphone icons created by Freepik - Flaticon

JS Functions

Variables created without a declaration keyword (var, let, or const) are always global, even if they are created inside a function.:

myFunction();
document.getElementById("demo").innerHTML = a * a;

function myFunction() {
  a = 4;
}