Is it better to learn JavaScript or Python as a first language?

5 points by Pbyte ↗ HN

12 comments

[ 2.1 ms ] story [ 36.2 ms ] thread
JavaScript will be more friendly to you, and will open the doors to more applied languages, including Python.

If you learn Python first, you might have trouble learning other languages.

Ideally, in the end it wont matter - a programmer can program in any language, but for starters I would say start with JavaScript.

Why would learning Python make it difficult to learn other languages? Just curious.
Python's syntax and idiom is more esoteric. While JavaScript does have some nits, it conforms more to C-style idiom (PHP, Java, C#, C++) and so those basic visual parsing skills will be more transferable. The C# syntax will be more immediately familiar to someone who knows only JavaScript than someone who knows only Python.
> Python's syntax and idiom is more esoteric.

I know, but sometimes 'esoteric' is better for beginning programmers. Compare the lesson on ternary operators:

some(blah) if 'a' in blah else blah

(blah.indexOf('a') != -1) ? some(blah) : blah;

I actually agree with the comment, but for entirely different reasons.

For me learning Python first (Well, not first, but it was the first language I learned that wasn't like...qbasic or pascal or something nasty and dos-y like that - I started using Python circa 1.5.2 on an early G3 Mac) ruined just about every other language for me because, well, they're just all so much work. Python just stays out of your way so well 99% of the time, and it has the nicest (Not necessarily LARGEST, but best curated/most coherent) standard library of any language I've used.

That said, Scala (and Lift in particular) have been catching my eye lately - not quite as elegant (but with a few new tricks too...), but the performance characteristics are certainly appealing, which is the one area where python is...lacking.

(comment deleted)
You wont go wrong with either. Javascript is good for in web pages verses python being the server side to produce dynamic pages. You'll find you probably use both in a web project anyway.

Learn one, then learn the other - start where you want to.

I think Both. You almost always need a back-end for the javascripts apps you make. That back-end can be Python.
In general, python is a more "regular" language with less unusual cases - so it tends to show up a bit more often in traditional programming 101 courses. It also promotes readability by making indentation a part of the language syntax.

That said, Javascript is readily available (a runtime in your browser), so no additional installation steps are necessarily required to start. Javascript also follows C syntax patterns which also appear in a number of other languages whereas python is a bit unusual in the way it distinguishes code blocks (using indentation).

Either will work, I think that python is a bit more straightforward for your first few programs.

You'll ultimately want to learn both, but start with Python.

Python is the definition of a general-purpose, beginner-friendly language that can also be used for more advanced stuff. That's part of what makes Python such a good CS101 language.

JavaScript is primarily a client-side language focused on interacting with web browsers and the DOM. This is starting to change with the advent of Node.js, but I would _not_ recommend jumping straight into Node style evented-IO if it's your first language.