I came across this exercice on the code academy and I don't understand why my code does not work. can someone explain to me and help me? thank you so much!
Next, below the variables, write a conditional statement that checks if the value of checkA is equal to the value checkB. If true, return the result of the callback function. If false, return the string 'inconsistent results'.
Finally, using console.log(), log the invocation of checkConsistentOutput() with two arguments: the addTwo() function and any number.
THIS IS MY CODE:
const addTwo = num => {
return num + 2;
}
const checkConsistentOutput = (func, val) => {
let checkA = val + 2;
let checkB = func(val)
if (checkA === checkB) {
return func(val);
} else {
return 'inconsistent results';
}
}
console.log(addTwo(5));
I can't pass the number 3 dunno why?