skip to Main Content

How to compare two big number in javascript

Why below code output result is equal? How to compare? var num1 = 340282000000000000000000000000000000001 var num2 = 340282000000000000000000000000000000000 // 3.402823E+38 if(num1 == num2) { console.log('num1 equal to num2'); } else if(num1 > num2) { console.log('num1 bigger than num2'); } else…

VIEW QUESTION
Back To Top
Search