The all caps naming convention of constant values doesn’t always apply just because you are using the keyword
const to declare a variable. This convention is generally only used when a variable points to a primitive value (such as a string/number/boolean) that should not change during the runtime of the code, and the meaning of the value would not be readily apparent in the code just by looking at it (it prevents magic numbers).
Concerning this exercise, yes, I would change
var to a
const when defining the function but no, I would leave the function name lowercase because the all caps naming convention doesn’t usually apply to functions.
const in JS does not always imply an actual constant value like you would traditionally think a constant would behave. Using
const with an object/array only means that you can’t change the reference the variable points to (for example, you couldn’t make it point to a different object/array). But you can still change the values in the object/array.
const array = [1,2,3];
array = 5; // perfectly legal
array = ['a','b','c']; // error, can't do
JS just loves to make things confusing, doesn’t it