Created
May 15, 2019 08:13
-
-
Save BeRo1985/3973f2b13fae2f66da7320ff6e012fc2 to your computer and use it in GitHub Desktop.
JS Bin ecmascript string type wierdness fun // source https://jsbin.com/xinogin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment