Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. const thang = new String("thang");
  2. const theng = String("theng");
  3. const thing = "thing";
  4. const thong = String({ rick: "sanchez" });
  5. const thung = new String({ rick: "sanchez" });
  6.  
  7. console.log(thang, typeof thang); // [String: 'thang'] 'object
  8. console.log(theng, typeof theng); // theng string
  9. console.log(thing, typeof thing); // thing string
  10. console.log(thong, typeof thong); // [object Object] string
  11. console.log(thung, typeof thung); // [String: '[object Object]'] 'object'
  12.  
  13. console.log({}.toString(), typeof {}.toString()); // [object Object] string
  14. console.log("abc".toString(), typeof "abc".toString()); // abc string
  15. console.log([1, 2, 3].toString(), typeof [1, 2, 3].toString()); // 1,2,3 string
  16. console.log((5).toString(), typeof (5).toString()); // 5 string
  17.  
  18. console.log(`thang is ${thang}`); // thang is thang
  19. console.log(`theng is ${thang}`); // theng is theng
  20. console.log(`thing is ${thang}`); // thing is thing
  21. console.log(`thong is ${thong}`); // thong is [object Object]
  22. console.log(`thung is ${thung}`); // thung is [object Object]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement