var x = 5; var y = 6; var z = x + y; |
Note From 1995 to 2015, the var keyword exclusively dominated JavaScript code. However, in 2015, the let and const keywords were introduced to the language. It’s recommended to confine the usage of the var keyword to code intended for older browser compatibility. |
Example using let
let x = 5; let y = 6; let z = x + y; |