-
-
Notifications
You must be signed in to change notification settings - Fork 458
Sulaiman week 9 #1027
base: manchester3
Are you sure you want to change the base?
Sulaiman week 9 #1027
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work Sulaiman, only a few small comments :)
💯
@@ -61,3 +67,4 @@ console.log(y); | |||
``` | |||
|
|||
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 } --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3/3 - perfect! Well done :) 💯
cartContains() { | ||
// Use console.log() to output everything contained in your cart | ||
console.log(`Your shopping cart has ${this.items.length} items: ${this.items}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
greeting() { | ||
console.log(`Hi! I'm ${this.name}.`); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, great use of string interpolation on line 31! Well done
} | ||
check_balance(){ | ||
console.log(this.amount); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this ever be true if you always set index to be 0 on line 36? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be true even without giving a value :|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Your Details
Your Name:
Your City:
Your Slack Name:
Homework Details
Module:
Week: