Avoid Mutations and Side Effects Using Functional Programming

Please see code below.

// The global variable

let fixedValue = 4;

function incrementer() {

// Only change code below this line

return fixedValue + 1;

// Only change code above this line



I have got the function declaration to pass, however; I am not sure what the hint is implying - " Using the increment operator (++ ) on fixedValue will mutate fixedValue , meaning it will no longer reference the same value it was assigned with." Why does the ++ increment operator behave this way when used in the case with ‘return fixedValue’?

++ always mutates the variable it is called on

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.