Tell us what’s happening:
hello there. I’m trying to solve this challenge using .reduce() method.
when trying to push to the accumulator, the console drop me an error:
TypeError: accumulator is undefined
why does it happens?
Your code so far
function fearNotLetter(str) {
let arr = str.split('').map(char => char.charCodeAt());
console.log(arr);
let newArr = arr.reduce((accumulator, currentValue, index, array) => {
accumulator.push();
}, [])
}
fearNotLetter("abce");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0
Challenge: Intermediate Algorithm Scripting - Missing letters
Link to the challenge: