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



Smartphone icons created by Freepik - Flaticon

JS Functions

In HTML the value of this, in a global function, is the window object.

let x = myFunction();
function myFunction() {
  return this;
}
document.getElementById("demo").innerHTML = x; 

Invoking a function as a global function, causes the value of this to be the global object. Using the window object as a variable can easily crash your program.