Tell us what’s happening:
This basic section of Functional programming is confusing me.
When I set the incrementer seen below to return val + 1. I am returned the correct answer of 5 for newVal, and do not directly update the fixedValue; this falls apart for some reason if I set the return value to val++; I just keep returning 4, and I am not sure why. This issue has persisted across multiple lessons. Am I misusing it somehow?
Your code so far
// The global variable
var fixedValue = 4;
// Only change code below this line
let incrementer = (val) => val ++;
// Only change code above this line
let newVal = incrementer(fixedValue);
console.log(newVal)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
.
Challenge: Pass Arguments to Avoid External Dependence in a Function
Link to the challenge: