JavaScript is an awesome language? Or is horrible? Let’s talk about!


An idea for reflection taken from an article published on CodeProject.com.

Here a small resume, for the complete list refer to original article written by Dheeraj Kumar Kesri.

The Good

  • JavaScript is very lightweight and runs on the browser making user interactions fast and responsive.
  • JavaScript objects are dynamic. We can add or remove the properties or functions at runtime giving developers a high level of flexibility and control.
  • JavaScript functions are extremely powerful and are treated as first class citizens. Functions in any language contain some lines of code to perform a specific action. But in JavaScript, functions do much more.
  • Closures in JavaScript are inner functions. That means they are created inside a function and have access to the parameters and variables of outer function.

The Bad

  • Global variables are created outside of function scope and are prone to errors and undesired behavior. Since they can be changed (knowingly or unknowingly) from any part of the application, chances are high that your program may behave unexpectedly.
  • JavaScript tries to be smart and helpful to novice programmers by inserting semicolons automatically at places where they’re missing but are mandatory. While this leaves the developers less bothered about the syntax errors caused by semicolons, it is dangerous at times and results in undesired bugs that are hard to detect.
  • JavaScript comes with two sets of equality operators: “==” and “!=” and their siblings “===” and “!==”. The recommended set of operators to use are “===” and “!==” as they check both, the value and the type of the operands. The other evil set just checks for the value ignoring the type of the operands.

The original article

[embed]http://www.codeproject.com/Articles/1130883/JavaScript-The-Good-and-The-Bad[/embed]