habe ich den Prototyp Array
als Instanz von my
, denke ich book.aa
"aa"
angezeigt wird, aber es zeigt "undefined"
, warum? Vielen Dank!Warum kann ich den Prototyp von `Array` (` Array.prototype`) nicht überschreiben?
<html>
<head>
<title>Array Properties</title>
<h2>Array Properties</h2>
<script type="text/javascript">
function my() {
this.aa = 'aa';
}
Array.prototype = new my();
Array.prototype.bb = "bb";
var book = new Array();
book[0] = "War and Peace";
</script>
</head>
<body bgcolor="lightblue">
<script type="text/javascript">
document.write(book.aa+book.bb);
</script>
</body>
</html>