Live data from Hacker News

Human JavaScript

read.humanjavascript.com

41–43 of 43 posts

Re: Human JavaScript

#41
post #37

I stopped reading at the tilde argument for readability. I find the tilde token far more readable and easier to spot, and there's no confusion as to what the indexOf is checking for, the existence of an element in an array, where with the equality comparison tokens I need to stop and read what the heck it is comparing to. These should be reserved for when it's checking for a specific index or range. Those extra secon…

I think the tilde operator and Underscore are both equally cryptic and represent similar degrees of obfuscation. Tilde doesn't get much use, because it's prone to quirky behavior, particularly with respect to negative one in javascript. Gven that javascript has junk lying around like NaN, undefined, null, ==, ===, I tend to mistrust anything that isn't dog-ugly bland convention. Aliases are also ugly in my opinion, g…

That's what I mean by using patterns and shapes conventionally. By using the tilde only on indexOfs (math aside), it immediately communicates its reason and when you don't see it and instead see equality operators you know that it's NOT a 'has' operation but it's something that needs more attention. Of course this depends on a lot of people doing it besides you, but most of the code I trust and use mostly uses this pattern.

Re: Human JavaScript

#43
post #37

I stopped reading at the tilde argument for readability. I find the tilde token far more readable and easier to spot, and there's no confusion as to what the indexOf is checking for, the existence of an element in an array, where with the equality comparison tokens I need to stop and read what the heck it is comparing to. These should be reserved for when it's checking for a specific index or range. Those extra secon…

Underscore is not an obscure library. It's one of the most widely used JS (or even just code) libraries in existence. Look at the number of stars and forks on github.
Post reply on HN