Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var toString = Object.prototype.toString;
- var strLit = 'example';
- var strStr = String('example');
- var strObj = new String('example');
- console.log(typeof strLit); // string
- console.log(typeof strStr); // string
- console.log(typeof strObj); // object
- console.log(strLit instanceof String); // false
- console.log(strStr instanceof String); // false
- console.log(strObj instanceof String); // true
- console.log(toString.call(strLit)); // [object String]
- console.log(toString.call(strStr)); // [object String]
- console.log(toString.call(strObj)); // [object String]
Add Comment
Please, Sign In to add comment