3 ms·
>It's kinda sad that JavaScript needs so many lines of code to figure out if a number is even, but understandable due to its dynamic nature It doesn't. Javascr
by krapp 6y ago
>It's kinda sad that JavaScript needs so many lines of code to figure out if a number is even, but understandable due to its dynamic nature
It doesn't. Javascript doesn't need this many lines of code to figure out if a number is even. A simple modulo 2 check works just fine.
- wsc981 6y agoAh, so I guess it's just some over-engineered piece of code. Again I'm no web dev, so very limited JavaScript experience. Well, at least the author made it clear it was code from back when he was still learning JavaScript.
- krapp 6y agoYeah, unfortunately the entire javascript ecosystem is ridiculously over-engineered. In my day, all you needed was a text editor. Now you need a package manager and an abritrarily deep dependency tree of libraries, a complex toolchain and a test framework to write Hello World... often in another language that gets compiled into javascript. It was a simple, almost elegant language. You looked at a JQuery module, and you could understand it, modify it on your own, and use it without needing to understand the quirks of sixteen distinct build systems that would just be obsolete by next month. No one could delete a repository and break your software. There wasn't a single company and a single package manager basically controlling everything. There was competition and innovation and... I'll be in the angry dome if anyone needs me.