typeof operator returns the data type of the parameter, but it has various 'gotchas'.
Things to be aware of:
typeofrecognizes any complex data types, like Arrays or Maps, as simply
- There are better ways to determine the types of complex data objects. For arrays, you can call
Array.isArray(object)method. Other data types have similar methods for determining type.