demo.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // console.log(typeof '1');
  2. // console.log(typeof 12);
  3. // console.log(typeof false);
  4. var a;
  5. // console.log(typeof a);
  6. // console.log(typeof null); //object
  7. let b = {
  8. name:"图图"
  9. }
  10. let c = [1,2,3]
  11. function fn1() {
  12. return 12;
  13. }
  14. // console.log(typeof b);
  15. // console.log(typeof c);
  16. // console.log(typeof fn1);
  17. // console.log(b instanceof Object);
  18. // console.log(c instanceof Object);
  19. // console.log(fn1 instanceof Function);
  20. // console.log(Object.prototype.toString.call(1))
  21. // console.log(Object.prototype.toString.call('12'))
  22. // console.log(Object.prototype.toString.call(true))
  23. // console.log(Object.prototype.toString.call(a))
  24. // console.log(Object.prototype.toString.call(b))
  25. // console.log(Object.prototype.toString.call(c))
  26. // console.log(Object.prototype.toString.call(fn1))
  27. // console.log(Object.prototype.toString.call(null))
  28. console.log(false.constructor === String)
  29. console.log('12'.constructor === String)
  30. console.log((1).constructor === Number)
  31. console.log(b.constructor === Object)
  32. console.log(c.constructor === Array)
  33. console.log(fn1.constructor === Function)
  34. // console.log(a.constructor === undefined)
  35. // console.log(null.constructor === Null)