Advertisement
Guest User

Untitled

a guest
May 25th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="description" content="ecmascript string type wierdness fun">
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width">
  7. <title>JS Bin</title>
  8. </head>
  9. <body>
  10.  
  11. <script id="jsbin-javascript">
  12. regExString = /string/gi;
  13.  
  14. typeName = "TEmailString";
  15.  
  16. otherTypeName = typeName + "";
  17.  
  18. console.log(regExString.test(typeName));
  19. console.log(regExString.test(typeName + ""));
  20. console.log(regExString.test(otherTypeName));
  21. console.log("");
  22.  
  23. console.log(typeName.match(regExString) ? true : false);
  24. console.log((typeName + "").match(regExString) ? true : false);
  25. console.log(otherTypeName.match(regExString) ? true : false);
  26. console.log("");
  27.  
  28. console.log(typeof typeName);
  29. console.log(typeof (typeName + ""));
  30. console.log(typeof otherTypeName);
  31. console.log("");
  32. </script>
  33.  
  34.  
  35.  
  36. <script id="jsbin-source-javascript" type="text/javascript">regExString = /string/gi;
  37.  
  38. typeName = "TEmailString";
  39.  
  40. otherTypeName = typeName + "";
  41.  
  42. console.log(regExString.test(typeName));
  43. console.log(regExString.test(typeName + ""));
  44. console.log(regExString.test(otherTypeName));
  45. console.log("");
  46.  
  47. console.log(typeName.match(regExString) ? true : false);
  48. console.log((typeName + "").match(regExString) ? true : false);
  49. console.log(otherTypeName.match(regExString) ? true : false);
  50. console.log("");
  51.  
  52. console.log(typeof typeName);
  53. console.log(typeof (typeName + ""));
  54. console.log(typeof otherTypeName);
  55. console.log(""); </script></body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement