Misconceptions About JavaScript

Introduction

 
There are a lot of misconceptions about JavaScript. Let us discuss a few of them. 
 

JavaScript is not Java

 
It is very much necessary to clear that JavaScript has no relation with Java. It was initially named as LiveScript. It has been compliant with ECMAScript 5 Language Specifications. Just keep in mind, both Java and JavaScript are different animals.
 

JavaScript is not just a Web Development or Client Side Tool

 
JavaScript is a complete programming language and it is not only used in front end technology, but it has also emerged as a strong candidate for the future in Server-Side Development i.e. Node.js.
 

JavaScript is not Typeless

 
JavaScript is not typeless, like most scripting languages, it associates a type with values, not with variables. It is described as Dynamic Typing. It has six primitive data types: Boolean, Number, String, Null, Undefined, and Object.
 

JavaScript is Object-Oriented Language

 
Most of us think JavaScript is a structural language, but in actual it is an Object-Oriented Language. Everything in JavaScript is an object and it supports both of inheritance and aggregation. It is described as a Prototype Based Object-Oriented Programming Language. 
 

Browser API is not part of JavaScript

 
Window Object, Location Object, DOM are not part of JavaScript itself, these are browser features and JavaScript just provides API to use them. These APIs in general called Browser API, and they can vary from browser to browser. And this dependency is the main reason to have problems with to program for cross-browser site development.
 

Block Scope

 
Unfortunately, JavaScript does not respect block scope for undefined variables (variables without var, they are treated as global variables). So be careful with the implicit variable declaration. Furthermore, in JavaScript block scope is at function level not set of curly brackets.
 

JavaScript is not Context Free

 
In general, we consider it does not matter either a line is ended with a semicolon or not, but it can cause many issues-particularly in case of minification.
 

Validation of JavaScript

 
Now many IDEs provide JavaScript validation, even you can use tools/sites like JSLint with manual efforts. It’s not bad idea to use JavaScript strict mode.
 

Synchronous

 
JavaScript is basically single-threaded.
 

this Keyword

 
this keyword may refer to different things with respect to context. For example, in constructor this refers to object, in simple function this refers to window.
 

JavaScript Custom Objects are not JSON

 
JavaScript Custom Objects are not JSON. JSON cannot have functions, JSON is a data-interchange format.
 

Closures

 
A closure is a function having access to the parent scope, even after the parent function has closed. Closures are a very interesting feature and similar to delegates with a persisted state of the outer function.
 

Debugging

 
It is a little tricky yet very simple to debug JavaScript code. We may discuss this topic in detail in future articles.
 

Context and Scope are Different things

 
Context and Scope are different things, simply we can say Scope defines accessibility and life span. On the other hand, Context refers to what and where.
 

JavaScript Libraries and Frameworks

 
There are a lot of hot topics like Jquery/ Jquery UI/ Jquery Mobile, AngularJS/Ember, Knockout JS, Kendo UI, Node JS, Lo-Dash, React JS, Chart JS, Ionic and etc. These all are libraries and frameworks developed in JavaScript. These are add-ons, not the competitors.