0
觀察JavaScript代碼的以下各行不同的信息:typeof運算和運營商的instanceof返回同一變種
<!DOCTYPE html>
<html>
<head>
<title>typeof vs instanceof</title>
</head>
<body>
<script type="text/javascript">
var myString = "MyString";
alert(typeof myString);
alert(myString instanceof String);
</script>
</body>
</html>
第一警報說string
(小寫)當第二說false
...
爲什麼?
可能重複(http://stackoverflow.com/questions/203739/why-does-instanceof-return-false-for-some-literals) – BoltClock