Introduction
Previously, we looked into the functionality of Auto Paginated Dashboards (here). You know I always admire the power of JavaScript and my love for it is rapidly growing day by day.
During my code development experience, I encountered many surprising behaviors in JavaScript, many times. So I decided to document and share my experiences with you.
- When the return is missing, then also undefined is surely returned
Here in the code below, the GetResponse() method does not have a return statement but when the result of this method is assigned to a pre-initialized variable, in other words, a result, then it sets it to undefined.

- When nothing is returned, then also undefined is returned
Here in the code below, the GetResponse() method has a return statement and nothing is returned but when the result of this method is assigned to a pre-initialized variable, result, then it is set to undefine.

- Any number operated with undefined is Not a Number

- Any string concatenated with undefined is a string

- NaN + undefined = NaN. Really

- Number with Not a Number is not a number!! How confusing

- string + NaN = string
When we add a string to a number we always get a string as shown below.
So I decided to do the same thing with NaN and I got a string again as in the following:
Thus we can say that NaN is a number but factually it's not. - Functions with the same name are overridden by last written instance
Here in the following code, a function Magic has two definitions: one with single parameter, Magic(a), and another with two parameters, Magic(a,b). When we try to call this function, Magic(2) or Magic(2, 3), it always executes the last written instance of that function as shown below.


- Magically default – The arguments object


NitinPosted Apr 25, 2015, 3:02 AM
Good one
Santhakumar MunuswamyPosted Apr 25, 2015, 12:25 AM
Good Work
Karthik Muthu KaruppanPosted Apr 24, 2015, 5:50 PM
Good