• timhh@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    13 hours ago

    I’m guessing there’s a reason they wanted min() to be able to be called without any arguments but I’m sure it isn’t a good one.

    It not a totally unreasonable definition. For example it preserves nice properties like min(a.concat(b)) == min([min(a), min(b)]).

    Obviously the correct thing to do is to return an optional type, like Rust does. But … yeah I mean considering the other footguns in Javascript (e.g. the insane implicit type coersion) I’d say they didn’t do too badly here.