This repository was archived by the owner on Oct 26, 2020. It is now read-only.
Open
Conversation
msachi
reviewed
Jul 19, 2020
| ``` | ||
|
|
||
| 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 |
Member
There was a problem hiding this comment.
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"
|
|
||
| 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 |
| 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} | ||
| ``` |
| @@ -11,9 +11,15 @@ The output of running your code should be: | |||
|
|
|||
| class ShoppingCart { | |||
| */ | ||
|
|
||
| // Write your code here | ||
| class Person { |
| // Add your code here | ||
|
|
||
| } | ||
| class ATM { |
Member
There was a problem hiding this comment.
Very good! However, you don't need this.amount in the constructor.
| this.music.push(addSong) | ||
| } | ||
| play(){ | ||
| this.counterIndex = 0 |
Member
There was a problem hiding this comment.
I think this should be initialised in the constructor.
msachi
reviewed
Jul 19, 2020
|
|
||
|
|
||
|
|
||
| class MusicPlayer { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your Details
Your Name:
Your City:
Your Slack Name:
Homework Details
Module:
Week: