How to convert a negative number to positive in Node.js

1 Answer

0 votes
console.log(Math.abs(-2)); 
console.log(Math.abs(-1.89)); 
console.log(Math.abs(-0)); 

 
 
     
     
/*
run:
     
2
1.89
0
     
*/

 



answered Jun 19, 2022 by avibootz
...