Sarower Jahan Sarower Jahan - 7 months ago 27
Javascript Question

Convert negative and positive numbers to positive values javascipt

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

Thanks a lot.

Answer

You can try by this way..

Math.abs(-7.25); 

W3 Schools Demo

Comments