Understand JavaScript

JavaScript was invented as quick adhoc solution to make the web pages in the Browser more dynamic. And since then it has grown and took the crown from Perl as the duct-tape of the Web. 
JavaScript as Java (hence the name) borrowed much of the syntax from the C language.
The most common host environment for JavaScript is web browsers. Now days there is a common standard to which all the vendors ascribe. This is the reason why it is possible to write the same code and be able to run across different browsers.

Learn

JavaScript is somewhat easy and somewhat hard to learn. Syntactically there is advantage of being similar to C, but because they had to cram OOP and functional features after the fact it made the language a beautiful mess.
Not very good for beginners. On top of that OOP implementation is not very traditional, but Prototype based.

Prototype based OOP is such that the inheritance is performed via a process of reusing existing objects and modifying their behavior, which is very flexible and powerful technique but is harder to master.
In contrast in standard OOP we first define Classes and then at runtime we instantiate Objects from those definitions.
In prototype OOP the difference between Classes and Objects is moot, because at runtime you can modify a “Class” and at the same time you are instantiating an “Object“, which is a “Class” for any “Object” created from “it” … and so on and so forth …. in street terms it is turtles all the way …..

One of the biggest pity annoyance I have with JavaScript is that they had ~20 years to shorten the most used keyword in the language, I mean function() it is too long and the places you need to use it makes the code ugly and unreadable. Most of the other languages use 3 letter words such us : def and sub.

Beside the pun, wouldn’t it be fun() one new day under the sun, for them to finally jump the gun and in this jun-ction fix the function().

— me

Is it worth it ?

If you are doing web applications then JavaScript is very good choice. One benefit in this scenario is that you can write both the back-end and the front-end with the same language. This is a big advantage. A popular web server which is based on JS is Node.js.
The drawback is that beside web and mobile apps, JavaScript is rarely used.

JS syntax is both good and bad. Good because it prepares you if you decide to learn Java or C afterward. Bad because the goal post changed so much and the syntax has to bent to accommodate this change and become harder to write and read. Being Prototype based helps for adhoc changes, but does not force OOP discipline. For beginners it helps, but as the app grows it may become a drawback as they don’t have established mental patterns how to handle complex code base.

So if your interest is in Web development and you can be persistent enough to become comfortable with the Syntax and bend your mind abit to understand the concepts then you should consider it.

The popularity of JS means you will be able to find good paying jobs.

Pros and Cons

Love

  • Class syntax sugar
  • ; not required

Hate

  • Object.keys(obj).length
  • for in/of
  • Only Array 1D
  • last missing arguments

Miss

Where to start ?

First look the short tutorial on this site : [Learn JavaScript].

Next check the recommendations : [JavaScript suggest]

What to do if I’m stuck ?

Apart from what I’ve already written in similar sections for other languages (which you should definitely check) one other thing I do often is try different permutation of the same function, keeping the old around. At some point I will find a better or different nugget of code. Then I mix and match to get the better function. Sometimes I have to scrape it of course, you can’t always win.

Other times I get a better idea and will rework multiple Functions/methods. Keeping balance in this case is abit harder, but that is why you should follow the KISS principle i.e. write short Procedures, so you can reuse them as a Lego blocks when you reshuffle code.

Still have question

Check the JavaScript FAQ