javascriptは、配列の結合配列を作成するための使用方法の例を示します.

831 ワード

 
  
//js
        var arr = new Array();
        arr["A"] = "boss";
        arr["B"] = "Emp";
        for (var m in arr) {
            document.write(arr[m] + " ");
        }
        var person = new Object();
        person["name"] = "xiaoli";
        person["age"] = "18";
        person["salary"] = "1888.9";
        for (var p in person) {
            document.write(person[p] + "
");
        }
        // age ?
        if (typeof person["age"] == "undefined") {
            document.write("no");
        }