Hacker News new | past | comments | ask | show | jobs | submit login

A friend of mine is approaching programming (very beginner level) through JavaScript. Is there any resource you would suggest in the same vein of this?

EDIT: since people are asking, I agree that JS is not the best language to get started, but let's just say he needs to learn that.




This might be of interest: https://www.comp.nus.edu.sg/~cs1101s/sicp/ (SICP in js)


Not a direct equivalent, but I've frequently seen people recommend https://eloquentjavascript.net/


Seconding this recommendation.


I would suggest absolutely not learning programming via javascript as your first language.


I agree that javascript is a bit odd for a beginner in terms of scoping, callbacks, truthiness, etc. However, it's really broadly applicable, JS would be a horrible choice for a university introductory course but might not be a bad choice for a hobbyist who's trying to quickly start doing things that keep them interested in learning.

I would however, strong suggest that javascript shouldn't be someone's only language.


Python has the same scoping as JS. I really don’t get why people complain about this then propose python as an alternative. JS even got past that with let/const.


In JS, declaring a variable without var gives it a global scope, in python not so.

Also, js is a lot more inconsistent than python. The amount of js gotchas is huge(== weirdness, hasOwnProperty for iterating through object fields, binding of this, only 64 bit doubles as a number type). Python is much less surprising, and gives you much less opportunities to screw up.


As a sibling to my other comment: Python is not less surprising, when programming in a JS style.

`nonlocal` is crazy. That lambdas may only be a single line is annoying. Being unable to print anything out of a map or filter operation without first converting to a list gets tedious quick. And not being able to go in for a quick monkey patch on repr, because builtin classes are magically different than user defined classes in “some way”, which makes modifying them prohibited, is limiting.

Sure, the easy retort is: that’s not what you should be doing anyways, python just enforces it. But I’d personally hate to see such an argument in the comment section of SICP, the pinnacle of programmer freedom.

Edit: and what about mutable default parameters?? I’ve had a fair amount of experience with python and sill been bitten by a mutable default parameter bug (not quite that, but related) in the past couple months. JS gets rid of that entirely by making them just syntactic sugar for what it would do anyways, which is much easier to reason about.


The bug I had was declaring variables in the body of a class without `self.`. Turns out that makes them static. Ironically similar to JS making non prefixed declarations global, except I received no in editor warnings about that, and it wasn’t something beaten into my head from the day I started.

Edit: or was it that I initialized them at time of declaration rather than in the constructor? Not sure. Something along those lines.


Most of the issues I find people annoyed with in JS are becoming less of an issue with modern idiomatic JS that is less object oriented, more functional and with ES6 utilities replacing more troublesome legacy idioms. I work on a fairly large app that uses little no classes. Also, I haven't had to use hasOwnProperty in a year! I just use Object.keys()


That’s a strange decision with regard to variable definitions, but not really a “scoping” abnormality. As in: that’s the scope you’d expect from a global variable, but not the syntax you’d expect to get you a global variable. Anyways, a base VS Code installation will throw a warning about that.

The other things are also not scoping. I’m not arguing JS is consistent, I’m just saying people should stop complaining about its scoping then offering python as a solution.


As someone who just spent a day hunting down a Heisenbug caused by using a default argument bound to a datetime.now(), I beg to differ.

Honestly, all languages have quirks. When pummeling a language for gotchas, may he whose favourite language is without quirks cast the first stone.


I don't think anyone is making a case for any given language being without quirks, but I think it's highly relevant how easy it is to stumble upon them.

If the quirks reside mostly in parts of the language only touched in really advanced expert use, it's generally not a problem because the people who venture there will know what to look out for. If your language has a quirky while statement on the other hand, it's something everyone will trip over.

E.g. Python's default mutable argument thing is fairly common to trip over (but on the other hand the behaviour is consistent and predictable once you know it), but monkey-patching builtins is not quite as common and definitely in the realm of "don't touch unless you know what you're doing".


The issue isn’t that it’s “don’t touch if you don’t know what you’re doing”, it’s “you can’t touch this at all, even if you might know what you’re doing or be willing to accept the consequences of your experimentations”


I agree with everything


May I suggest my course on the fundamentals of programming with JavaScript ES6 https://www.youtube.com/playlist?list=PL-xu4i_QDSxcoDNeh8rx5...

It is heavily inspired by SICP and covers important topics like recursion, iteration, static vs. dynamic typing, testing and more.

Each video is accompanied by a text version, a quiz and an interactive programming exercise (links are in video descriptions). The course is completely free of charge and I’ll be happy to answer any questions and help your friend solve problems if he or she decides to do the exercises on our site.


Why is JavaScript an absolute requirement? I guess he can learn python as his first programming language which I personally think will be easier to setup/run in the machine instead of installing node.


Yes. And for beginners, https://py3.codeskulptor.org/ is fantastic.


And also Python Tutor:

http://pythontutor.com/


A great complement to that would also be to use Jupyter, whose notebooks are similarly interactive and not dead like typing into a blank terminal or IDE.


freecodecamp.org is pretty good at taking a practical approach to learning programming, primarily with JavaScript. But if your friend wants to also understand the basics of computer science it's worth considering doing both.


I guess I struggle to see why it has to be Javascript exactly (even if js6 isn't all bad). How about reasonml or clojure(script)?




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: