I'm still learning JavaScript,reading books,utilizing FireBug,experimenting.
I'm amazed and stuck on thing below.
Have function declaration:
var t = function (args){
...
}
It's assumed,that it's varargs.
I call it like:
<body onload="t({to:100,from:0})">
It's possible to get from argument value by calling:
args.from
The result of typeof args.from is number
That looks sane.
pay attention: number is in lower case
I am interested of what instance args.from is.
Actually, can't get its instance value.
tried:
args.from instanceof Number
args.from instanceof String
args.from instanceof Object
args.from instanceof Boolean
It is not Number - very strange
It's not Object - quite strange
It's not String -that's OK
It 's not Boolean -that's OK
It's neither null nor 'undefined' - looks OK.
What is it?
instanceofoperator is used for Object values, not primitive values...typeoffor primitive values, andinstanceoffor Object values...