2017-10-15 13 views
1

私は初心者のJavascriptから二次元配列演習をしていますが、ブラウザのコードの出力はありません。何故ですか?多次元配列 - 出力なし

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="UTF-8"> 
     <title>Chapter 2, Example 9</title> 
    </head> 
    <body> 
    <script> 
    var personnel = []; 

    var personnel [0] = []; 
    var personnel [0] [0] = "Name0"; 
    var personnel [0] [1] = "Age0"; 
    var personnel [0] [2] = "Address0"; 

    var personnel [1] = []; 
    var personnel [1] [0] = "Name1"; 
    var personnel [1] [1] = "Age1"; 
    var personnel [1] [2] = "Address1"; 

    var personnel [1] = []; 
    var personnel [1] [0] = "Name1"; 
    var personnel [1] [1] = "Age1"; 
    var personnel [1] [2] = "Address1"; 

    document.write ("Name: " + personnel [1] [0] + "<br/>"); 
    document.write ("Age: " + personnel [1] [1] + "<br/>"); 
    document.write ("Address: " + personnel [1] [2] + "<br/>"); 

    </script> 
    </body> 
</html> 
+0

十分にあると思います。次の行の 'var'単語が問題を引き起こしています。 – naimul64

答えて

1

私は十分であることが

personnel [0] = []; 
personnel [0] [0] = "Name0"; 

ない

var personnel [0] = []; 
var personnel [0] [0] = "Name0"; 

一つ "varが" 一度変数人員の定義