Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Javascript You will be creating a custom object called catalogObject that will serve as a container for all of the song catalog functionality. This object
Javascript
You will be creating a custom object called catalogObject that will serve as a container for all of the song catalog functionality. This object will include catalog properties and methods. We will incrementally add and test functionality. Initially, we'll declare the catalogObject, declare an array property _songs initialized to an empty array, add method addSong(props) to add a song to _songs, and method listSongs() to list all of the songs in _songs:
- _songs: empty array property
- addSongs(props): Add a song to _songs, where method parameter props, short for properties, is a song object. The addSongs() method must use the String trim() (Links to an external site.) method to ensure the song title has no leading or trailing white space.
- listSongs(): Iterates through _songs array and lists out the songs. You must use a template literal (Links to an external site.) to output the songs to the Console. Template literals make formatting multi-variable output easier.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started