June 2014
Intermediate to advanced
696 pages
38h 52m
English
It is often useful to determine whether an object you have gotten back from a command is of a certain type. You can do this in a couple different ways. For example, one way is to use the isinstanceof operator, which compares the object types and returns true or false. For example:
([1,2,3] instance of Array) //true
The util module also provides the isArray(object), isRegExp(object), isDate(object), and isError(object) convenience methods to determine whether an object is an Array, RexExp, Date, or Error object. For example:
(util.isArray([1,2,3]) //true.
Read now
Unlock full access