//變數
var i = 'I am a string';
console.log('變數:',i);
//數組
var arr = [1,2,3,4,5];
console.log('數組:',arr);
//對象
var obj1 = {
key1 : 'value1',
key2 : 'value2',
key3 : 'value3'
};
var obj2 = {
key6 : 'value4',
key5 : 'value5',
key4 : 'value6'
};
var obj3 = {
key9 : 'value7',
key8 : 'value8',
key7 : 'value9'
};
console.log('對象:',obj1);
//對象數組
var objArr1 = [obj1,obj2,obj3];
var objArr2 = [[obj1],[obj2],[obj3]];
console.log('對象數組1:',objArr1);
console.log('對象數組1:',objArr2);
/*
輸出:
變數:I am a string
數組:[1, 2, 3, 4, 5]
對象:Object { key1="value1", key2="value2", key3="value3"}
對象數組1:[Object { key1="value1", key2="value2", key3="value3"}, Object { key6="value4", key5="value5", key4="value6"}, Object { key9="value7", key8="value8", key7="value9"}]
對象數組1:[[Object { key1="value1", key2="value2", key3="value3"}], [Object { key6="value4", key5="value5", key4="value6"}], [Object { key9="value7", key8="value8", key7="value9"}]]
*/