1.7 KiB
1.7 KiB
title |
---|
Manipulating Complex Objects |
Manipulating Complex Objects
Here’s the example:
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
}
// Add record here
];
Here’s a solution:
After string // Add record here
we add new album to the myMusic
. You need to start from ,
. And you can just copy already created album:
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
}
and paste after ,
:
// Add record here
,
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
}
];
Now, you can change values your album:
// Add record here
,
{
"artist": "Deep Purple",
"title": "Smoke on the water",
"release_year": 1976,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
}
];
Here’s a full solution:
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
},
// Add record here
{
"artist": "Deep Purple",
"title": "Smoke on the water",
"release_year": 1976,
"formats": [
"CD",
"8T",
"LP"
],
}
];