The general rule is to always declare a variable with const unless you need to mutate it, then use let. The trick here is that doing an unshift on the array is not mutating the variable itself, but rather the array the variable is pointing to, so you can use const for arrays and still change the array itself. Now if you were going to assign the variable arr a completely different array then you would have to use let.