So often I see functions being assigned to variables in JavaScript like this:
var square = function(number) {
return number * number;
}
Is there any benefit to using const
instead if the variable will never be reassigned to another function or value? Is there any reason not to use const
?
const square = function(number) {
return number * number;
}