Bug in challange compiler?

Hej!

I just did the .reduce challange with what i think should be acceptable code, considering I’m using the .reduce function;

function getRating(watchList){

 return watchList
 .filter( chris => chris.Director === "Christopher Nolan")
 .map(rating => rating.imdbRating)
 .map(Number)
 .reduce((accu,current) => accu + current)
 /watchList.filter( movie => movie.Director === "Christopher Nolan").length

}

However, when i run the tests it fail on the point requiring the user to use the .reduce method

Am i missing something here?

Thanks! <3

Br
E

Your code is fine, this is caused by bug that is worked on (see link below). To make test pass just put all chained methods in the single line with the watchList.

sanity is correct. You can bandaid fix it by sticking those chained methods on one line.

Not:

watchList
 .filter(/* stuff */)
 .map(/* stuff */)
 .map(/* stuff */)
 .reduce(/* stuff */)

but:

watchList.filter(/* stuff */).map(/* stuff */).map(/* stuff */).reduce(/* stuff */)

It’s OK if the editor automatically wordwraps it, just don’t put any whitespace in the chain.

Yes, it’s a bug - they’re looking into it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.