Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

shahd-week-9 #1029

Open
wants to merge 1 commit into
base: manchester3
Choose a base branch
from

Conversation

shahdalhaj
Copy link

Your Details

Your Name:
Your City:
Your Slack Name:

Homework Details

Module:
Week:

@@ -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
Copy link
Member

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
Copy link
Member

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}
```
Copy link
Member

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 {
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct :)


}
class ATM {
Copy link
Member

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
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants