Type Operators
Operator | Description | JS Example |
---|---|---|
typeof | returns type of variable | a = 5; |
instanceof | returns true if given object is an instance of specified type | var a = new String('apple'); |
Tutorials
Examples
typeof
a = 4;
output = typeof a;
console.log(output);
a = "hello world";
output = typeof a;
console.log(output);
instance of
a = new String("hello world");
output = a instanceof String;
console.log(output);