freeCodeCamp / wiki

freeCodeCamp's deprecated wiki articles
http://www.freecodecamp.com/wiki
281 stars 308 forks source link

Algorithm Wherefore Art Thou - Solution needs to be updated. #1191

Closed raisedadead closed 8 years ago

raisedadead commented 8 years ago

Refer : https://github.com/FreeCodeCamp/FreeCodeCamp/issues/9421

The code in Advanced code solution is not working when the last element of the source object is correct while other elements are wrong. For example, whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { first: 1, last: "Capulet" }); will return [{"first":"Tybalt","last":"Capulet"}] which is not right. I think using .reduce() function is not the best way to do this. Please change it. Thank you.

Rafase282 commented 8 years ago

The current advance code passes the test. http://forum.freecodecamp.com/t/algorithm-wherefore-art-thou/16092