1. Computing & Technology

How Hard is JavaScript To Learn?

From , former About.com Guide

Comparing JavaScript to Other Programming Languages

If you already know another programming language then learning JavaScript will be much easier for you than learning that other language. Learning your first programming language is always the hardest one since when you learn a second and subsequent language that uses a similar programming style you already understand the programming style and just need to learn how the new language sets out the commands to do the things you already know how to do in another language.

There are at least five different programming styles and learning a second programming style is more difficult than learning a new language that uses the style you already know. Most programming languages only support one of the programming styles but a few support two styles. JavaScript is one of those that supports two styles allowing you to use either of the two most popular stles of procedural or object oriented programming. So if you already know a procedural or object oriented language you will find learning to write JavaScript the same way relatively easy.

Another way in which programming languages differ is that some are compiled while others are interpreted. The difference between these two is that a compiled language is fed through a compiler which converts the entire code into something that the computer can understand. The compiled compiled version is what gets run and if you need to make changes to the program you must recompile the program before you can run it again. An interpreted program is one where the original statements are read and converted into something the computer can understand at the time the individual commands are to be run. JavaScript is an interpreted language which means that you can make changes to your code and run it again straight away to see the effecto of your change without having to recompile the code.

Another difference between programming languages is where they can be run. For example with programs intended to run on a web server you need to have a web server running with the appropriate language support in order to be able to test programs written in that language.

JavaScript has many similarities to a lot of other programming languages and so if you know one of those other languages you will find it fairly easy to learn JavaScript and if you know JavaScript you will find it fairly easy to learn the other similar languages. Where JavaScript has the advantage is that support for the language is built into web browsers so that all you need to be able to test your programs as you write them is a web browser to run the code in - and that is something just about everyone has already installed on their computer. You do not need to install a server environment to be able to run tests, you do not need to upload the files to a server elsewhere to be able to run tests, and you do not need to compile the code before you can test it. That makes JavaScript one of the ideal choices as a first programming language to learn as testing your code as you go is far easier than almost every other alternative language.

The one area in which learning JavaScript is harder than other programming languages is that different web browsers interpret some JavaScript slightly differently. That introduces one extra concept into JavaScript that other programming languages don't need - that of feature sensing to test which way a given browser expects to perform certain tasks. Of course if you learn JavaScript first then learning other languages where this isn't required will be easier.

Conclusions

In many ways JavaScript is the easiest programming language to learn as your first language. The way that it functions as an interpreted language within the web browser means that you can easily write even the most complex code by writing it a small piece at a time and testing it in the web browser as you go. Even small pieces of JavaScript can be useful enhancements to a web page and so you can become productive almost immediately.

©2012 About.com. All rights reserved.

A part of The New York Times Company.