how to calculate absolute value in javascript in calculator code example Example: js absolute value Math.abs(-4)//returns 4 Math.abs(4)//returns 4