Reasons to use JavaScript, with Pros and Cons!

JavaScript is world’s most misunderstood language; and that’s may be because of the name. It has a prefix ‘Java’ in its name; for which few people thinks it has some relation with JAVA, but actually it is not. But the most misinterpretation is done due to the second word in its name, which is ‘Script’. Maximum people think JavaScript is not a programming language; it is only used to do some validation or animation kind of stuff in the client side. But they are COMPLETELY WRONG.

JavaScript is a full-fledged programming language, which provides many unique features. The world’s first ‘lambda’ language provides many such features which the MIT people couldn’t develop in 40 years.

It’s not a web toy:

It’s not a script to validate forms or making animations. It’s a real language; small and sophisticated. It’s not a subset of JAVA. It’s a completely independent, flexible, super dynamic, object oriented language which has a very bright future. Frameworks like backbone, ember, angular, jQuery, and many more, who are developed on top of JavaScript, are changing the old concepts of web development. So don’t dare to take JavaScript lightly.

Load and go delivery:

It doesn’t make any .exe, .dll or ay abstract class files. So, it throws errors and exceptions only while executing that particular path of the program. This approach has two advantages.

First, it helps debugging. In case of languages like JavaScript, where you don’t have to use any IDE, this approach actually helps you in proper line by line debugging.

Second, if some other part of the same program is under construction, then also you can run the other flows of the program.

Loosely typed:

Though the fashion is with strongly typed languages, where we let the compiler to check and compile as much as possible, the loosely typed language has also its own advantages.

  • Loosely typed language gives the developer more control over the code. He doesn’t have to bother the variable type, function return type and all those stuffs.
  • An attribute can be read from any object. It doesn’t matter of which type it is.
  • There is no need to for function overloading separately. One function can handle all types.
  • No types mismatch error in your whole function.

Objects are special here:

In JavaScript, everything is object. And objects are really special here.

Objects as general containers:

This was a brilliant idea; to make objects as hash table, where you can add any property to an object at any point of time. This gives you the power to access the properties in different ways too; like, using the dot (.) operator (obj.propertyName), or using [], like (obj[‘propertyName’]).

Objects as unordered collection:

Here an object is an unordered collection of name, value pair. Values can be of any type, including other objects. This approach is really good to represent records and trees. Every object in JavaScript can be compared as a little database.

Functions are different:

JavaScript has introduced many special features in its functions which makes them different.

No need of function overloading:

A function is able to accept any type or arguments and also can return any type of value. They can accept any number of arguments even without declaring. This flexibility reduces a lot of codes in a project.

Meta programming:

Not only objects, but also the functions can be stored, passed and returned just like any other value. That means, you may write codes for a function, which will return a function and after executing the returned function you got the required value. In many cases situation like this arrives in our projects. JavaScript handles them really very nicely.

Prototypal inheritance:

The concept of inheritance is not classical in JavaScript. It’s prototypal. Here objects can be inherited directly from objects. There are no classes here in JavaScript (Though you can make class like objects, following some conventions). This prototypal inheritance does the same thing differently. This is more flexible than classical, suitable for dynamic languages, very simple to use, no need to use the ‘new’ keyword.

Syntactical advantages:

Syntactically also it has few advantages.

  • It has a C like syntax structure.
  • Multi level break is supported.
  • Var a= input || myValue, syntax like this reduces the need of extra if else in the code.
  • Missing semicolon is handled automatically.

Lambda language:

The scope that an inner function has is continued even after the parent function is returned. Due to this approach, we can make private variables in JavaScript and also can use AI like logics. This is the first lambda language to go mainstream. This has changed the old concept of scopes in certain extent.

It’s not only for browsers:

Many people have a misconception that JavaScript is only for browsers. While the truth is it is a multi platform language. Besides browsers, the JavaScript is used in:

  • Dashboards
  • Dreamweaver
  • Photoshop
  • PDF editors
  • Articulate
  • Yahoo Widgets
  • Few embedded systems are also using JavaScript now a days

Few disadvantages:

Sometimes the features mentioned above can bring some hard experience in your project. Here are few cons or disadvantages of JavaScript.

  • Because of load and go delivery approach, JavaScript doesn’t have linkers. Therefore the compilation units are all combined in a common global space, which causes few security issues sometimes.
  • JavaScript only has single inheritance; multiple inheritances are not possible.
  • No copy or equal method is there in JavaScript.
  • The bit wise operators in JavaScript convert the operand in 32-bit signed integer and turn the result back to 64-bit floating point. So, bit wise operation is slower here.


JavaScript is different than other languages and according to me, a language should be different, otherwise there’s no meaning of its existence. JavaScript gives you few extra ordinary features, whereas it also has some cons in it, but it’s all up to the developer how smartly he uses a language.

Now, JavaScript is not alone. It has jQuery, data binding frameworks and many other tools in its family. Day by day, people are reducing the dependency in server side and trying to make a web app more dependent on client side. These approaches are the first sign of the bright future of JavaScript.

About This Author

Hello! I am Paul Shan, a JavaScript Expert, Full Stack and DevOps Engineer cum Consultant based out of Bengaluru, India.

  • Manas Tunga

    “JavaScript only has single inheritance; multiple inheritances are not possible”. What does it mean ? object A can inherit from B and B can inherit from C so object A inherits from both the B and C .Multiple inheritance is done by adding new objects to object’s prototype chain. In statistic languages like java,c# the same concept also applies class A can’t directly inherit from both B and C. So its not a disadvantage of javascript but its one of its beauty to have prototypical inheritance

    • metalshan

      The thing you are talking about is multi-level inheritance, not multiple inheritance. Now suppose I have a class ‘mammal’ and another class ‘wingedAnimal’. Now I wanna make a class for ‘Bat’. How will you do that in Javascript? Without repeating your code or violating the coding standards?

  • metalshan

    multilevel inheritance DOES NOT violates coding standards.

    Coding standards are just standards and only a coder can violate this.
    Language X = multiple + multi level inheritance.
    Javascript = Only multi level inheritance.

    See, there are situation where you actually need MULTIPLE inheritance. Like the ‘Bat’ example I mention in my previous comment. You make that using javascript and post the code here, then I will tell you where the things are going wrong.

    The picture you posted obviously says a flaw of multiple inheritance, but this flaw can be resolved. But it completely depends on the developer how he uses. But because of this you can’t say that multiple inheritance is something which is a curse. And not having this feature makes a language devine.