js
Number.EPSILONاستخدامها الصح مش a === b بدلها، لكن Math.abs(a - b) < Number.EPSILON لما تقارن أرقام عايز تسامح فيها عن الخطأ.
البرهان
js
console.log(0.1 + 0.2 === 0.3, Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON);
console.log(Number.EPSILON);النتيجة
false true 2.220446049250313e-16