This article is about the weirdness of javascript and how to handle it by xtype.js. So I am talking about weirdness in terms of types in JS. The typeof operator returns the type in a string format of the unevaluated operand.
For example:

typeof({}) => will return 'object'

typeof(5) => will return 'number'

Well, this is not weird.
Let me show you something weird,

typeof(new Date())  => will return 'object'
typeof([‘Max’, ‘Carl’, ‘Tom’])  => will return 'object'
typeof(/ab+c/i) => will return 'object'       

So it may create problems when you have to do some kind of validations on a type basis. But with xtype.js there is a reliable solution for it.

#javascript #xtype.js #programming

JavaScript: xtype.js
1.35 GEEK