4 ms·
There should probably be a javascript version
by forkLding 9y ago
There should probably be a javascript version
- nevir 9y agohttps://github.com/denysdovhan/wtfjs https://github.com/denysdovhan/wtfjs
- astrobe_ 9y agoLanguage inconsistencies and questionable decisions is why I use my own language whenever I can. When something is wrong, I just fix it. The end result is that it is therefore ugly, stupid and mean for everyone else though.
- oconnor663 9y ago> The principle of least surprise is not for you only. The principle of least surprise means principle of least my surprise. - Matz, the inventor of Ruby
- forkLding 9y agoThanks, didnt know they already had one
- dehef 9y ago== is most funny operator of all time. My prefered: .1 + .2 == .3 \\false [] == false \\true but {} == true \\false
- Doxin 9y agoAll of those have a sane reasoning though. 0.1+0.2 is in fact, not equal to 0.3. it is equal to 0.30000000000000004. Floating point numbers aren't exact and you shouldn't expect them to be. When comparing things to a boolean that thing gets cast to a boolean. This is by design. bool([]) evaluates to False, so obviously False==False returns True. Same goes for your last example, bool({}) evaluates to False, after which False==True obviously returns False. Now whether or not you like the way those works, that's how it works by design and is hardly unexpected, except if you're unfamiliar with the language.
- BrandoElFollito 9y ago> that's how it works by design and is hardly unexpected Not only that but also very useful (checking if a list a is not empty is easy to read for instance (if a:...)) Well except the first example which is an annoying fact of life.