Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
Why itās return ātruefalseā? I think this is due to the nuances of data types
5 Respostas
+ 1
Aleks this is a common problem in javascript calculations. Try console.log(0.1*0.2);
and you will see. Google javascript floating point precision for more info!
+ 2
ThĆ“ng NguyĆŖn, ODLNT, thank you for the answers!
+ 1
Aleks it's because === is a comparison operator. So it will return true or false. More info here: https://www.w3schools.com/js/js_comparisons.asp
+ 1
https://code.sololearn.com/WrixzjKbUTWD/?ref=app
https://stackoverflow.com/questions/11695618/dealing-with-float-precision-in-javascript
0
I mean - why first comparison return true, but second - return false. They have identical structure. The only explanation that i see is related to data conversion when moving to integer values