A piece of code is unexpectedly returning -Infinity. What arithmetic operation could be causing this?

  • Division (/)
  • Addition (+)
  • Exponentiation (**)
  • Multiplication (*)
When a piece of code returns -Infinity, it is usually due to a division operation where you are dividing a finite number by zero. In JavaScript, dividing any finite number by zero results in -Infinity. Make sure to handle cases where division by zero can occur to prevent unexpected -Infinity values in your code.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *