How to change a negative number to positive?
How to make a negative number to be positive (ie. -25 to be 25) in JavaScri开发者_开发问答pt?
There are various ways:
var m, n = -25;
m = -1 * n;
m = -n;
m = Math.abs(n);
var n= -25;
var m= -1 * n;
use Math.abs function
精彩评论