Conversation
lannem
left a comment
There was a problem hiding this comment.
Excellent work Sulaiman, only a few small comments :)
💯
| ``` | ||
|
|
||
| What will be the output of this code. Explain your answer in 50 words or less. | ||
| <!-- The first output x is logged with its assigned value 9, the second output is the object y => { x: 10} where the key x is accessed and re-assigned in function f2, so as f2 is called the value of x become 10. if y is consoled befor f2 call it will be { x: 9 } --> |
| } | ||
| cartContains() { | ||
| // Use console.log() to output everything contained in your cart | ||
| console.log(`Your shopping cart has ${this.items.length} items: ${this.items}`) |
| greeting() { | ||
| console.log(`Hi! I'm ${this.name}.`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Perfect, great use of string interpolation on line 31! Well done
| } | ||
| check_balance(){ | ||
| console.log(this.amount); | ||
| } |
There was a problem hiding this comment.
Great work well done! You could maybe tidy up some of your indentation but apart from that this is great :)
| } | ||
| play(){ | ||
| this.index = 0 | ||
| if(this.music.length > 0 ){ |
There was a problem hiding this comment.
Will this ever be true if you always set index to be 0 on line 36? :)
There was a problem hiding this comment.
I think it might be true even without giving a value :|
There was a problem hiding this comment.
Sorry my comment is incorrect! I misread it as you checking if index > 0
| if(this.index < 0){this.index = this.music.length - 1} | ||
| console.log(`Currently playing: ${this.music[this.index].song} by ${this.music[this.index].singer}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Great job. To simplify your code you could also call your play() function inside your skip() and previous() functions instead of typing out the console log again.
Well done Sulaiman!
Your Details
Your Name:
Your City:
Your Slack Name:
Homework Details
Module:
Week: