6 ms·
Those "wacky" things about any language are things that doesn't quite fit with your knowledge of already learned languages.
by ankurdhama 10y ago
Those "wacky" things about any language are things that doesn't quite fit with your knowledge of already learned languages.
- ivraatiems 10y agoI mean, not really. Lisp isn't "wacky" even if all you know is Java; it's just different. JavaScript is wacky coming from anywhere because there's lots of seemingly illogical or confusing behavior baked into it by design.
- shakna 10y agoJS is leaky. It's Type Coercion often relies on the inner string representation of its objects. So many of its oddities come from this. JS doesn't have integers. It only has floating point numbers, and the complexity they can bring. > 10.8 / 100 => 0.10800000000000001 Its inconsistency on dealing with things that become NaN confuse the hell out of a good deal of people, because it simply doesn't reflect the way other languages deal with it. > Array(2).join("wat" - 1) => NaNNaN > Array(2).join("wat" + 1) => wat1wat1 JS is "wacky" because a programmer often has to understand implementation details to debug. A C programmer in rare cases may need to understand how their code translates to assembly, yes. But it is incredibly rare. A Python programmer almost never needs to understand how the object type is constructed, or how instanceof works. A Ruby programmer can get by without understanding how their numbers change from integers to BigNums and back. A Scheme programmer doesn't need to understand Cheney on the MTA or how their compiler generates C code. It explains speed and other tradeoffs, but it rarely if ever changes the actual code they write. In JS, I have to be careful not to use arrays and currying together, because I might get a false where I expected an array. This isn't a language I would want to hand to someone who has never programmed.