constmixedArray=[-5,10,-3,12,-9,5,90,0,1]// no need of a function.constfilteredArray=mixedArray.filter(item=>item>=0)console.log(filteredArray)// OUTPUT: (6) [10, 12, 5, 90, 0, 1]
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
We can use the
filter
method.Or, in a single line,