Products
GG网络技术分享 2025-11-14 05:29 1
javascript // 一、用Math.abs函数处理异常数值 let point1 = { x: NaN, y: Infinity }; let point2 = { x: -NaN, y: -Infinity }; let distance = Math.sqrt + Math.pow); console.log; // 输出
// 二、用Math.abs函数获取差值 let num1 = 5; let num2 = -3; console.log); // 输出 5 console.log); // 输出 3

// 三、用Math.abs函数获取距离 let num1 = 2; let num2 = 7; let diff = Math.abs; console.log; // 输出 5
Demand feedback