-
Notifications
You must be signed in to change notification settings - Fork 328
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.
Hey there,
A good effort, although I am missing:
- 2-step3.js
- 6-step3.js
- 7-step3.js
- step4.js
which is quite a lot of the homework.
I would look at the feedback as it seems you are missing some of the concepts these exercises are mean't to illustrate.
Best of luck with the rest of the course. 😄
@@ -2,6 +2,7 @@ | |||
|
|||
function foo(func) { | |||
// What to do here? | |||
return func | |||
} |
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.
Not quite. All you will do here is return the function object. You want to call func
and return the value from calling func
.
....
return func();
....
@@ -3,23 +3,38 @@ | |||
// use a 'for' loop |
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.
Where did 2-step3.js go to?
} | ||
|
||
console.log('for', repeatStringNumTimesWithFor('abc', 3)); | ||
|
||
// use a 'while' loop | ||
function repeatStringNumTimesWithWhile(str, num) { | ||
// add your code here | ||
return str; | ||
while (num > 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.
You have to define string before you can use it.
This is where your program errors out because it cannot find string.
It is very obvious that you have not run or tested your program, otherwise you would have seen the error message
, and been able to correct the problem which is:
let string = '';
this.name = "Jumbo"; | ||
this.color = "Black"; | ||
this.numLegs = 4; | ||
} |
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. ✅
Just wondering why you removed the line that actually creates an instance of a Dog
.
this.color = "brown"; | ||
this.numLegs = 4; | ||
} | ||
// Add your code below this line |
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.
This question was about nested loops, no the Dog
.
@@ -3,8 +3,14 @@ | |||
const values = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c']; |
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 seem to be missing, 6-step3.js
, 7-step3.js
, and step4.js
.
function removeDoubles(foo) { | ||
const uniqueLetters = []; | ||
for (let i = 0; i < foo.length; i++){ | ||
uniqueLetters.push(foo[i]); |
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.
All you are doing here is copying the whole array. Not removing the duplicate values.
You need to check first whether the value already exists in uniqueLetters
and if it does just skip to the next iteration of the loop, and if it does not, add it to uniqueLetters
.
i did some steps, the other steps still working on it. sorry!!