Hello, everyone!
I can’t figure out what I’m doing wrong in this task. I’ve tried several options, but the answer is not accepted.
Task: Pass a reference to your elemValue
function as the callback to your .map()
method.
javascriptCopy code
const evalFormula = (x, cells) => {
const idToText = id => cells.find(cell => cell.id === id).value;
const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi;
const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2));
const elemValue = num => character => idToText(character + num);
const addCharacters = character1 => character2 => num => charRange(character1, character2).map();
}
My solution attempts:
1.
const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num));
2.
const addCharacters = (character1, character2, num) => {
return charRange(character1, character2).map(
elemValue(num)
);
}
3.
const addCharacters = character1 => character2 => num => {
const charRange = charRange(character1, character2);
return charRange.map(elemValue);
};
4.
const addCharacters = character1 => character2 => num => {
charRange(character1, character2).map(elemValue);
}
5.
const addCharacters = character1 => character2 => num => {
charRange(character1, character2).map(elemValue(num));
}
However, the answer is not accepted and I consistently receive: "Sorry, your code does not pass. Keep trying. You should pass a reference to `elemValue` as the callback to your `.map()` method."
Please advise on how to complete this task.
### Challenge Information:
Learn Functional Programming by Building a Spreadsheet - Step 50
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-functional-programming-by-building-a-spreadsheet/step-50