Help me clean up my functional JS
This is working for me, but I feel like there is a more concise way to use the filter on an array of objects. This code goes through an object containing multiple-choice questions. Each question has...
View ArticleHelp me clean up my functional JS
That’s not how filter works: it needs to return true or false. You don’t return a value, what you do is return a new array containing only the elements that return true for the condition you give it....
View ArticleHelp me clean up my functional JS
Thanks, that helps a lot. You know, i’ve been doing this (as a hobby) for 5 years now, I hope I eventually can sort these out. A lot of my applications involve complex objects like this one. I tried...
View ArticleHelp me clean up my functional JS
This is working for me, however I can’t seem to grab just the ID with this syntax, I get an error ‘id is not defined’ return quizQuestion.answers.find((answer) => answer.correct === true)[id]; I...
View ArticleHelp me clean up my functional JS
I believe it should be .id instead of [id], since id is a property of each object. Read full topic
View Article