+ 2

I found something strange on JavaScript

I noticed that when you try to divide any number by 0 the result is Infinity, and if I do anything with this result (number related), the result is also Infinity. So I tried writing a string variable with the "Infinity" as the value and multiplied it by 10, the result was "Infinity". Why the program didn't outpoted an error? I was multiplying an string by a number. https://code.sololearn.com/WRBm2Nh68DIw/?ref=app

10th Mar 2019, 6:48 PM
oh Common
oh Common - avatar
2 odpowiedzi
+ 4
//Infinity is displayed when a number exceeds the upper or lower limit of the floating point numbers, which is 1.797693134862315E+308. //There is positive infinity and -negative infinity, resembles upper limit abd lower limit
10th Mar 2019, 7:03 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
Shudarshan Rai 👑 thank you, but, I'm asking about why the program didn't outpot an error, I was multiplying a string by a number.
10th Mar 2019, 9:26 PM
oh Common
oh Common - avatar