4 ms·
The real question is "why JavaScript rather than Python?" The only reason JavaScript is so popular is that it runs in the browser. JavaScript is otherwise a pre
by beojan 10y ago
The real question is "why JavaScript rather than Python?" The only reason JavaScript is so popular is that it runs in the browser. JavaScript is otherwise a pretty poor language, and certainly much harder to learn than Python.
- Eridrus 10y agoRunning in the browser and having pretty good debugging tools seems pretty useful to me.
- jventura 10y agoMaybe brython can help with that! https://brython.info/ https://brython.info/
- darpa_escapee 10y agoCompared to other languages and environments, debugging JavaScript can be difficult if you don't have a good idea of what's going on behind the scenes in specific browser versions, the DOM and JavaScript VM. Throw callbacks, Promises, etc into the mix and things get confusing pretty fast. Comparatively, other languages, like Python, will throw sane exceptions and a meaningful stack trace when something goes wrong.
- sotojuan 10y agoJS is a pretty bad first language to learn—too many quirks and random syntax in the last few years. Python is dead simple—I recently had to take on a project written in it having never programmed in Python before and I essentially did not have to learn it to get the feature done.
- darpa_escapee 10y agoI had a similar experience with JavaScript, assuming you make _extensive_ use of ES2017 syntax and features. It's actually very nice, provided you have a compatible browser, but there's a long way to go still.
- wwweston 10y agoHaving used both to teach beginners, I can assure you that your categorical statements are false. I might give Python an edge for a number of reasons (a shell is a simpler environment than a browser in a number of ways, some of the language features are cleaner), but to say that it's much harder doesn't bear out with my experience. Capable first-timers become productive at about the same rate. I've found it's mostly experienced developers who trip over JavaScript, because they're carrying a set of expectations and are weirded out when it does something different. Turns out principle of least surprise means different things depending on people's backgrounds. Feel free to choose to start someone with Python if you prefer it, or if they're likely to want to work in a domain where it makes sense (say, data science), but it's probably not going to change your learn-to-code outcomes much.
- mixmastamyk 10y agoThat ES6 was created, to substantially redesign the language says otherwise.