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