A Language for Beginners
I’m a regular attendee of the local freeCodeCamp meetup, and recently they have decided to restart the curriculum and start from the basics to help newcomers along in their journey of learning to code.
This got me to thinking about JavaScript recently. The freeCodeCamp curriculum focuses on JavaScript as the main language. For a curriculum meant for introducing newcomers to web development, this is the obvious, if not only choice.
However, leaving aside the fact that it’s required for web development, I think that JavaScript is a good choice of language for beginner programmers. When I began learning JavaScript, I had gotten more proficient in it than Java, which was basically the only language we used in class for over 2 years. In this post, I wanted to list some of the elements of the language and resources that make JavaScript easy to learn despite all the criticism you might hear.
Type System
When declaring a variable in JavaScript we don’t need to specify the type of the value. While many swear by static typing, I see this as an advantage for new programmers. This allows them to use variables without having to worry about the different data types like you normally would in Java or C++. While it is true that static typing has its advantages, for newcomers I see it as extra details that acts as a hurdle for learning actual programming concepts.
C-like syntax
Yet another feature of the syntax itself. JavaScript uses a very C-like syntax, and this is good because it establishes a familiarity with the syntax of other popular languages like Java, C++, and of course C. Aside from minor diffrences, the structure of loop and conditional blocks using curly braces look practically the same between all of these languages. For example, a for loop written in JavaScript can be copied and pasted into any of the other ones mentioned above and work just fine (barring some differences in variable declarations). This makes it easier to transition to another one of these languages should they land a job using one of those instead of JavaScript.
Object Oriented + Functional
While most of the starting curriculum for freeCodeCamp focuses on object-oriented teaching, it also touches on
functional programming aspects of the language a little further on. This is another aspect of JavaScript which made it
stand out. Being able to use array methods such as map
, filter
, and reduce
in a functional manner makes data
transformations look much cleaner, concise, and easier to read. While Java 8 does now include some of these functions,
they do not work as nicely as the ones in JavaScript, and in my opinion harder to read than just using a loop.
Mozilla Developer Network
The Mozilla Developer Network (MDN) is not so much a part of JavaScript itself, but it is one of the elements that made learning JavaScript a great experience for me. The MDN Web Docs is a comprehensive open source documentation for not only JavaScript, but also HTML, CSS, and other web development technologies. All the JavaScript functions are thoroughly documented with detailed examples, but also keeping the language and jargon use to a reasonable level, which is something I’ve always wanted with Java and C++. The formatting and styling of the pages on MDN makes it much easier to read and look for what you need, giving it a much more inviting look compared to, say, the [C++ Reference](http://en.cpp