Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="description" content="ecmascript string type wierdness fun">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- regExString = /string/gi;
- typeName = "TEmailString";
- otherTypeName = typeName + "";
- console.log(regExString.test(typeName));
- console.log(regExString.test(typeName + ""));
- console.log(regExString.test(otherTypeName));
- console.log("");
- console.log(typeName.match(regExString) ? true : false);
- console.log((typeName + "").match(regExString) ? true : false);
- console.log(otherTypeName.match(regExString) ? true : false);
- console.log("");
- console.log(typeof typeName);
- console.log(typeof (typeName + ""));
- console.log(typeof otherTypeName);
- console.log("");
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">regExString = /string/gi;
- typeName = "TEmailString";
- otherTypeName = typeName + "";
- console.log(regExString.test(typeName));
- console.log(regExString.test(typeName + ""));
- console.log(regExString.test(otherTypeName));
- console.log("");
- console.log(typeName.match(regExString) ? true : false);
- console.log((typeName + "").match(regExString) ? true : false);
- console.log(otherTypeName.match(regExString) ? true : false);
- console.log("");
- console.log(typeof typeName);
- console.log(typeof (typeName + ""));
- console.log(typeof otherTypeName);
- console.log(""); </script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement