Simply because Math.max() attempts to convert its arguments to numbers. An array does not convert into a number, so you get NaN.
Calling Math.max(...lengths) splits the lengths array into several arguments, which works (so long as they're all numbers, of course).
Understanding Math.max()
probability - How can there exist a maximum product for two integers? - Mathematics Stack Exchange
Event Rune math for double max speed rolls
I did the math no one asked for. To reach max level in Elden Ring, it would take approximately 170 hours at peak perfromance.
This is based on the assumption that a normal person could beat the game, get the end game sword, and golden scarab in about 10 hours. Then with each game it would take about 5 hours to beat. The rune costs are based on Elden Ring wiki multiplier and massacre time based on my brother timing me killing the frog bois. I based runes needed off getting to level 100 by the first playthrough and then subtracting it from the total. After that, I took the runes needed to get to level 100 and multiplied it by the same multiplier and subtracted.
Based on my shitty math, journey 5 is the best place to kill frog bois for maximum efficiency.
More on reddit.comVideos
The product of two numbers equals the difference of the squares of their average and the distance.
"I beg your pardon???"
Well, you know that $(a-b) \cdot (a+b) = a^2-b^2$.
Image you want to take the product of two numbers (let's say $37$ and $43$), you do that by calculating the average (which is $40$ in this case) and by calculating the distance to that average (which is $3$ in this case, the distance from $37$ to the average of from $43$ to the average).
Hence, $37 \cdot 43 = (40 - 3) \cdot (40 + 3) = 1600 - 9 = 1591$.
You can say "Ok, that's a neat trick for calculating by heart, but how does it help here?".
Well, you talk about different pairs of numbers, having $66$ as their pairwise sum. That means that their pairwise average ($\frac{\text{sum}}{2}$) is also always equal, being $33$, so you can write both numbers as $33-x$ and $33+x$, and their product equals $33^2-x^2 = 1089 - x^2$.
From that, you can easily see how the product of those two numbers is defined directly by the distance ($x$) to the average (being half of the sum ($66$) this question started with).
Now, I'm lost at the word 'maximum'; how can two fixed numbers—and with a fixed sum 66—have a varying product?
These aren't really "fixed numbers," though.
The problem statement tells us that we have "two positive integers." Let's name them $x$ and $y$. We think of both of these integers as being variable—which is to say, we're allowed to vary them. There's a constraint that we have to follow (the sum must be 66), but we can vary them however we want as long as we obey that constraint.
When we vary the numbers $x$ and $y$, their product $xy$ may change as well. The problem statement asks us to find the largest value of $xy$ that we can achieve this way.
Additionally, the solution presents this wonderful statement: [...]
The solution that you were given starts with two premises. One is $x + y = 66$, the constraint that we were given in the problem statement. The other is the equation $\frac{x + y}{2} \ge \sqrt{xy}$, which is the AM–GM inequality. From these premises, it concludes that $xy \le 1089$, which is to say, it's impossible to achieve a product larger than $1089$.
At this point, the solution skips over a step. It should demonstrate that it is possible to obtain $1089$ as a product, but that step has been omitted.
Since we can obtain a product equal to $1089$, but we can't obtain a product larger than $1089$, the largest product we can obtain ($M$) is exactly $1089$.