Skip to content
Advertisement

How to assign an IF statement inside a map function [closed]

I am trying to assign an IF statement inside a map function but it asks for a return. If I put the return, in front of the IF, does not work. Currently getting the following error on Lint: Line 78:52: Array.prototype.map() expects a return value from arrow function array-callback-return

I expect just to push objects into the array.

What is the correct way to assign the IF inside a map?

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement