Checking Object Types

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.108.197