Fork me on GitHub
#other-languages
<
2021-10-02
>
Martynas Maciulevičius07:10:53

I think I love Javascript. Try evaluating this: !"" == !"text"

Stuart15:10:45

so empty string is falsey, but a non empty string is truthy?

andy.fingerhut17:10:54

If you like that, you might also enjoy this: https://www.destroyallsoftware.com/talks/wat

💯 1
1
Martynas Maciulevičius18:10:22

It's not that I like that. But what the implications of this are. Because it retains the type but it's still an empty string. And in Clojure empty string is truthy. I was doing something in JS and I was wondering why it wasn't allowed to have a empty string as a route name (long story) for a handler. And for some reason the authors check whether the string is !routeName and then throw an error (and they also write that they don't want empty strings there). Yes, I know about the batman thing and that JS has some quite strange quirks. But then you also have null and undefined... why. If empty value is falsy, why even have any concept of null...

1