by Klathmon · 8y ago · 0 comments
Now looking at the ES5 spec [0], the max length of an array is an unsigned 32-bit integer due to the `ToUint32` operation that the spec defines. So that means our `craftCapacity` here needs to be 2^32-1
Sadly we can't use `Number.MAX_SAFE_INTEGER` here because that assumes double-precision floating points as the underlying storage method, so we just have to hardcode our value:
const hovercraft = Array(4294967295).map(() => 'https://imgflip.com/meme/Bad-Joke-Eel')
[0] While the spec says this in a roundabout way, i'm not sure if any implementations actually adhere to this limit, and i'd guess most convert the array to a hashtable internally long before it gets to that size.It could be liquefied remains of eels! Although I'm guessing we would need to study a few of the translations in languages that explicitly differentiate between "a collection of whole somethings" and "an amount of something". Although now that I'm thinking about it in english saying "my hovercraft is full of eel" would imply that it's an amount of eel, not a distinct number of eels.
Still, if it were the "amount", a simpler JS expression would convey the message:
const amountOfEelsInHovercraft = Number.MAX_VALUELet me guess, I bet you think people can transmit information via the fluctuation of electromagnetic waves too. Brilliant!