Use the typeof operator to get the type of an object or variable in JavaScript . The typeof operator also returns the object type created with the “new” keyword. As you can see in the above example, the typeof operator returns different types for a literal string and a string object.
Read more