The Difference Between Var, Let, and Const in Javascript

function printCoins(){
console.log(numberOfCoins)
}
printCoins()var numberOfCoins;numberOfCoins = 5
const numberArray = [1, 2, 3, 4, 5]const numberArray = [5, 4, 3, 2, 1]
const numberArray = [1, 2, 3, 4, 5]numberArray.push(numberArray[4] + 1)console.log(numberArray)
//output
numberArray = [1, 2, 3, 4, 5, 6]

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store