Convert a negative number to a positive one in JavaScript September 19, 2022 by Tarik You could use this… Math.abs(x) Math​.abs() | MDN