Why in javascript, divide by zero = infinity???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
9th Aug 2019, 8:36 AM
arieh
3 Answers
+ 6
Just think about it Let's say you have a number 10 10 % 5 = 2 10 % 2 = 5 10 % 1 = 10 10 % 0.5 = 20 10 % 0.1 = 100 10 % 0.00...001 = 10^n times 0 I hope you understand.
9th Aug 2019, 9:19 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 4
Because the designers decided not to throw an exception in this case.
9th Aug 2019, 9:23 AM
Sonic
Sonic - avatar
0
Ok... but it's a bit "illegal"...
9th Aug 2019, 9:32 AM
arieh