Files

86 lines
1.3 KiB
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Manipulating Complex Objects
---
# Manipulating Complex Objects
2018-10-12 15:37:13 -04:00
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
2018-10-12 15:37:13 -04:00
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:
```
2018-10-12 15:37:13 -04:00
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
}
```
2018-10-12 15:37:13 -04:00
and paste after `,`:
```
2018-10-12 15:37:13 -04:00
// 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:
```
2018-10-12 15:37:13 -04:00
// Add record here
,
{
"artist": "Deep Purple",
"title": "Smoke on the water",
"release_year": 1976,
"formats": [
"CD",
"8T",
"LP"
],
"gold": true
}
];
```
Heres a full solution:
```javascript
2018-10-12 15:37:13 -04:00
var myMusic = [
{
artist: "Billy Joel",
title: "Piano Man",
release_year: 1973,
formats: ["CD", "8T", "LP"],
gold: true
2018-10-12 15:37:13 -04:00
},
// Add record here
{
artist: "Deep Purple",
title: "Smoke on the water",
release_year: 1976,
formats: ["CD", "8T", "LP"]
2018-10-12 15:37:13 -04:00
}
];
```
</details>