25 String 对象中的属性
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<!-- String 对象中的属性 -->
</head>
<body>
<script>
var str = new String("JavaScript");
String.prototype.name = null;
str.name = "Hello World!";
document.write(str.constructor + "</br>");
// 输出:function String(){[native code]}
document.write(str.length + "</br>");
// 输出:10
document.write(str.name);
// 输出:Hello World!
</script>
</body>
</html>