1. var :
var is the oldest way to declare variables in JavaScript. Variables declared with var are function-scoped, which means that their scope is limited to the function in which they are defined, or the global scope if they are defined outside of a function.
Example: