Question 8
Consider the following JavaScript code. What will be logged on to the console once the code is executed?
class Album { constructor(creator, albumName) { this.creator = creator this.albumName = albumName this.songs = [] } addSong(song) { this.songs.push(song) }}
class Song { constructor(name, duration) { this.name = name this.duration = duration this.album = null } addAlbum(album) { this.album = album }}
a1 = new Album('creator1', 'Album1')s1 = new Song('Song1')
s1.addAlbum(a1)console.log(a1.songs.length)0
1
2
None of these