JavaScript (JS) is a lightweight interpreted or JIT-compiled programming language with first-class functions.

Closures

An inner function has always access to the variables and parameters of its outer function, even after the outer function has returned.
An inner function has always access to the variables and parameters of its outer function, even after the outer function has returned

Tips and Tricks

Shortest Simplest way to print current year
<script>document.write(new Date().getFullYear())</script>


Get url without parameters
var mainpage = window.location.origin;
console.log(mainpage);

https://azurered.azurewebsites.net
window.location.href = mainpage;
Redirect to https://azurered.azurewebsites.net
Window.location / Location

Quick redirect to main page without parameters

window.location = '/';