This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.
Smartphone icons created by Freepik - Flaticon
A function can access variables defined outside the function:
let a = 4; myFunction(); function myFunction() { document.getElementById("demo").innerHTML = a * a; }