Dmitri Pavlutin 5/18/2021

Why Math.max() Without Arguments Returns -Infinity

Read Original

This technical article delves into the JavaScript Math.max() function, explaining the rationale behind its return value of -Infinity when invoked without arguments. It uses examples with arrays, including empty ones, to illustrate how this behavior serves as a mathematical identity element, ensuring consistency in operations like finding the maximum value across multiple arrays.

Why Math.max() Without Arguments Returns -Infinity

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

1
The Beautiful Web
Jens Oliver Meiert 2 votes
3
LLM Use in the Python Source Code
Miguel Grinberg 1 votes
4
Wagon’s algorithm in Python
John D. Cook 1 votes