4 ms·
What subtle counterintuitive behavior are you talking about? The only things I can think of are == and if (0).
by woah 12y ago
What subtle counterintuitive behavior are you talking about? The only things I can think of are == and if (0).
- zxcvcxz 12y agoI don't get it either. The only one that got me was that you have to scale some decimal numbers to whole numbers to multiply them. 0.1 * 0.2 //0.020000000000000004 But this has never caused issue for me except when tried to make a "prime number finder" when I first started using it. If I was going to build some stat site with a whole bunch of scientific data, I'd probably break out the python. IMO JavaScript is just the best language to work with if you're coding web sites or web applications (and probably prototyping custom UIs for anything). Plus you can use multiple languages server side easily, so use the right tool for the right job.
- rtpg 12y agoIf you try to combine object methods that use 'this' with functional programming-style code, you're in for a bad surprise
- woah 12y agoYea, when people try to rebuild all the fanciful embellishments of classic OOP GUI programming in JS, they're going to have a hard time. Unfortunately I've had to maintain this kind of code in the past. Don't use 'this'. I'm afraid that the addition of the 'class' keyword in es6 will make this tendency worse in some programmers. Along with block scoping, it's a feature lobbied for by people who don't actually code much JS.
- orangecat 12y agoAnd that's JavaScript's fundamental problem: it's full of attractive nuisances that have the nasty property of silently doing the wrong thing. 'this', 0=='0'==false==[]!=[], global variables by default, objects that are almost-but-not-quite maps, for-in-oops-forgot-hasOwnProperty, etc, etc.