JavaScript is the most used language of this time on the planet earth.
-
Everything is object in JavaScript, even function is also a first class object.
- You can pass function object as an argument to a function
- Function object can be returned from a function
- Function may assigned to a variable
- Function May be stored in an object or array
- JavaScript programs use Unicode character set (UTF-16) which is super-set of ASCII and Latin-1 and supports virtually every written language currently used on the planet
- NULL is an object in JavaScript
- NaN is a number, if we say typeof NaN, then it would be number
- typeof Infinity is a number
- Function can execute themselves. We call them self executing function. This is very important concept/feature which is used at many places
-
using typeof we can not get if any variable is of type array. So how we can determine if a variable is of type array?
var ar = [1,2,3]; ar instanceof Array // this will return true because ar is of type array
There is one more way to get the type of any variable:var ar = [1,2,3]; Object.prototype.toString.call(ar); // "[object Array]"
No comments:
Post a Comment