5 Reasons why javascript is hated by developers.
Ankit Soni
Posted on August 3, 2020
Javascript is a programming language build by Brendon Eich
in April 1995. He was told to make a language to run in Netscape's browser
and that too within 10 days.
The hard part was producing a rich and powerful language while being prohibited from using the object-oriented
syntax reserved for Java. A lot of developers hate this language. Below is a comparison of it from other languages.
In this graph, you can easily see how fast javascript has grown in terms of job opportunities from 2019 - 2020. Now you may have a doubt why it is so popular even if there are so many people who hate this language. In this post, I have tried to give you some reasons why it is being hated.
Reason 1. Loosely typed language.
Javascript is a loosely typed language, but what does it mean? It means that you don't have to declare the type of a variable while defining it.
- Case 1: Variables without defining any data types.
- Case 2: NaN is a number (quite confusing)
- Case 3: You can mix different data types in an array.
Reason 2. Concept of "==" && "===".
In very simple words "==" cares about equality of two variables without caring about the data types, whereas "===" cares about the equality as well as the data type of both the variables. Let's understand it better by the following example.
In third line of code, double equals does not care about the data types of the variables which are different and then prints true, whereas triple equals strictly care about the data types of the variables and hence prints false.
Reason 3. Functions can call themselves (IIFEs)
IIFE stands for immediate invoked function experssion. Lets learn its logic.
This function calls itself by adding parentheses at the end of the function definition.
Reason 4. Adding two variables of different data type
Look at the following example and try to think about the output.
It logs out "123"
and 15
in the console but how is it happening. Javascript says that when you add number and string then number changes to a string
, whereas when you put a plus sign before a string then string changes to a number
which is quite bizarre.
Reason 5. Javascript performs differently for different browsers.
This generally happens due to the reason that every browser has its different ECMAScript engine which it uses to compile javascript code. Most famous ones are V8 by google chrome and spiderMonkey by mozilla firefox. Javascript is different from languages like c, c++ and java. Java codes are compiled the same on all the devices which are using JVM in their machines, but that does not happen with javascript. Hence a developer has to look at how their website is performing in different browsers.
Conclusion
I showed you a lot of negatives about this language but don't dare to judge this language to be crappy. It has a huge internet community, as well as a lot of frameworks and libraries, are running on it. Below is the list of some of them.
- Front-end: Reactjs, Angular, Vuejs, emberjs etc.
- Back-end: Nodejs
- mobile-development:React native and ionic
- game-development: Phaser, babylonjs and playcavasjs
- Desktop application: electron
If you are still reading it. Consider reading my blog on promises
by clicking on the following link.
Posted on August 3, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
September 11, 2024