Hey guys!
I’ve been playing around with the map function and I thought I had it down, but I guess not.
I’m having some trouble with the output of my map function.
Here’s an example of what should happen.
correctStream(
["it", "is", "find"],
["it", "is", "fine"]
) ➞ [1, 1, -1]
1 for true and -1 for false. Depending on whether userInput = correctInput
The code I have so far is
function correctStream(user, correct) {
return user.map((word, i) => word[i] == correct[i]) ? 1 : -1;
}
All this does is return ‘1’ . Nothing else. Does anyone know why this is happening? I thought the map function would test for every element and return a value for each test.
Thanks!