-
-
Notifications
You must be signed in to change notification settings - Fork 458
shahd-week-9 #1029
base: manchester3
Are you sure you want to change the base?
shahd-week-9 #1029
Conversation
@@ -33,6 +33,7 @@ console.log(y) | |||
``` | |||
|
|||
What will be the output of this code. Explain your answer in 50 words or less. | |||
for the first log in line 27 the output should be 10 for the global variable x, line 31 output will be undefiend the function call is empty no thing has been passed to the function to process, line 32 log undefined since y has been defiend locally inside f1 |
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.
Close :)
Line 31 output will be undefined because nothing is being returned from the function.
Line 32 will give a "ReferenceError: y is not defined"
@@ -14,7 +14,7 @@ Take a look at the following code: | |||
``` | |||
|
|||
Explain why line 4 and line 6 output different numbers. | |||
|
|||
line 4 log x=2 as it's been defined as a local variable inside the curly brakets, line 6 log x=1 for the global variable that has been defiend in line 1 |
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.
Correct! :)
f2(y); | ||
console.log(y); | ||
f2(y); the output for this line should be 10 and the value is returned and not logged to the console; | ||
console.log(y); it will log the object y ===> {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.
Both correct :)
@@ -11,9 +11,15 @@ The output of running your code should be: | |||
|
|||
class ShoppingCart { |
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.
Good job!
@@ -22,6 +22,14 @@ | |||
*/ | |||
|
|||
// Write your code here | |||
class Person { |
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.
Correct :)
|
||
} | ||
class ATM { |
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.
Very good! However, you don't need this.amount
in the constructor.
this.music.push(addSong) | ||
} | ||
play(){ | ||
this.counterIndex = 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.
I think this should be initialised in the constructor.
@@ -19,10 +19,41 @@ This means the order the songs are played in will be random, but each song will | |||
*/ | |||
|
|||
|
|||
|
|||
class MusicPlayer { |
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!
Your Details
Your Name:
Your City:
Your Slack Name:
Homework Details
Module:
Week: