make a value positive in javascript code example
Example 1: js make value positive
Math.abs(-4)//returns 4
Math.abs(4)//returns 4
Example 2: distinguishing positive numbers in javascript
arr.filter(i => {return i >= 0})
Math.abs(-4)//returns 4
Math.abs(4)//returns 4
arr.filter(i => {return i >= 0})