How to convert a negative number to positive in JavaScript

1 Answer

0 votes
console.log(Math.abs(-9)); 
console.log(Math.abs(-3.14)); 
console.log(Math.abs(-0)); 

 
 
     
     
/*
run:
     
9
3.14
0
     
*/

 



answered Jun 19, 2022 by avibootz

Related questions

...