Hi!, I just want to know if I made the albums array right. I don’t know how to insert an object in an array. Also, I don’t know how to do the band info. Did I make it right? Thank you.
A Pen by Christian Barrameda (codepen.io)
-Burds
Hi @Burds
Yes, your album array is correct.
You are able to access the values of such an object array with a mix of bracket and dot notation. For example favoriteBand.albums[2].name
will select the name of the third album.
For the bandInfo
you can use a template string and use variables like I showed above to fill in the values. As a start you could write:
bandInfo = `${ favoriteBand.name } is a band from ${ favoriteBand.nationality }.`
and then extend the template string with various other information.
I hope that gets you further. Let me know if you need more help.
Michael
I really appreciate your help Michael. Thats a big help. Thank you very much!
Burds
Thanks you two. I had the object members of the album array wrong. I had the title as the name and the year as the value, as in:
{“Slipknot”:1999}
Thanks for the correction. I was stuck trying to put both the name and value of each array item into a template literal. No wonder it didn’t work.