There are lot of misconceptions about JavaScript. Let us discuss 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 compliance
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 as front end technology, it has emerged as strong candidate for
future in Server Side Development i.e. Node.js.
JavaScript is not Typeless
JavaScript is not typless, like most scripting languages, it
associates 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 use thing 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
Prototype Based Object Oriented Programming Language.
Browser API is not part of JavaScript
Things like Window Object, Location Object, DOM are not part
of JavaScript itself, these are browser features and JavaScript just provides
API to use them. These API in general called as Browser API, and they can vary
from browser to browser. And this dependency is main reason to have problems 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 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 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 very interesting
feature and very similar to delegates with persisted state of outer function.
Debugging
It is 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, in simple we can say
Scope defines accessibility and life span, on other hand Context refers to what
and where.
JavaScript Libraries and Frameworks
There are 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 or frameworks developed in
JavaScript. These are add-ons not the competitors.
No comments:
Post a Comment