I’ve written the following code:
it doesn’t work as expected and I can clearly see that is not clean at all, especially starting from line 45, how I can write it in a better “functional” way, do I have to use filter method?.
Thanks in advance
Well for starters: && .
For seconds: Map expects every callback to return something. If you’re wanting to get a filtered array back, then indeed the .filter() method is what you want. Note that filter’s callback expects a boolean response.
yes, the target get in the postsCats variable an array of the objects that have in the category property array the two numbers stared in the var relatProdId and the var prodId. How would you implement this?
Thanks in advacne
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.