Sarower Jahan Sarower Jahan - 9 months ago 47
jQuery Question

Convert negative and positive numbers to positive values

I am getting a dynamic value. Sometimes it comes with positive value and sometimes with negative value. But I always need a positive value. Is there any way to convert all negative or positive values to positive values?

Answer

You can try by this way..

Math.abs(-7.25); 

W3 Schools Demo