I am having trouble with this assignment. It asks me to put in another album after the billy joel one, but do I add a break or something to signal that I have another album? Here’s my code. Idk I’ve been having a hard time with Javascript so I don’t think I’m explaining my problem well.
whoops sorry
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
"artist": "Lorde",
"title" : "Pure Heroine",
"release_year": 2014,
"formats": [
"mp3",
"LP",
"radio"],
"gold": true
}
];
Your code is private to your browser and your account - we cannot see it - you will need to paste it here or in some code sharing site
This exercise is practice with objects - an object is collection of arbitrary things - each thing has a name - the javascript term is property - and a value i.e. the thing itself
arbitrary means each thing can be a number a string an object an array etc - anything
an object is marked by a pair of braces {...}
- you put the things inside the braces following the property: value
syntax
this differentiates an object from an array which is a collection of things between brackets [...]
- an array is an indexed or ordered collection of things - since an array is ordered each thing in an array gets its index or position number as its name - so in bracket [...]
notation there is no need to write the name/index of each thing separately since the order is visible - so only the thing/value itself needs to be written separated from other things with a comma
in this exercise myMusic
is an array of album things - each album is an object so each album needs a separate pair of braces {...}
here is my code :
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
"artist": "Lorde",
"title" : "Pure Heroine",
"release_year": 2014,
"formats": [
"mp3",
"LP",
"radio"],
"gold": true
}
];
You miss:
objectName = {
before:
so if you want to accomplish this lesson your code should look like that:
var myMusic = [{“
artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [“CS”, “8 T”, “LP”],
“gold”: true
},
// Add record here
myMusic1 = {“
artist”: “Artysta”,
“title”: “Cos tam”,
“release_year”: 1999,
“formats”: [“mp3”, “wml”, “vlm”]
}
];
Good luck