1
我被要求將一個鍵(名爲interest)添加到一個對象(名爲myObject)。該鍵必須具有數組值。我在這裏發佈代碼。但它不起作用。如何使用數組值添加對象的鍵?
var interests=[];
var myObject = {
name: 'Eduardo',
type: 'Most excellent',
// Add your code here!
interests:'reading',
interests:'singing'
};
'興趣: 'reading','singing']',或者如果你想添加一些東西給對象:'myObject.interests = ['reading','singing']'。 – Andy