Project completed#5
Conversation
updated the FizzBuzz code
updated problems
Refactored to use ES6 single-line functions where necessary.
All done
re-structured the code based on the solutions lecture
taithethai
left a comment
There was a problem hiding this comment.
Overall good clean code. Just a few improvements to be made.
| // 'hello world' -> 'hello world!' | ||
| // code here | ||
| }; | ||
| const combineNames = (firstName, lastName) => firstName + ' '.concat(lastName); |
There was a problem hiding this comment.
You could use template literal here.
| // 'Lambda', 'School' -> 'Lambda School' | ||
| // code here | ||
| }; | ||
| const getGreeting = name => 'Hello '.concat(name).concat('!'); |
There was a problem hiding this comment.
You could use template literal here.
| return result; | ||
| }; | ||
|
|
||
| const isPrime = (num) => { |
| } return false; | ||
| }; | ||
|
|
||
| const returnFirst = (arr) => { |
There was a problem hiding this comment.
You're returning the last item in the array here.
Also, naming a variable l could be confusing for other people to see.
| // return a string that is all of the words concatenated together | ||
| // spaces need to be between each word | ||
| // example: ['Hello', 'world!'] -> 'Hello world!' | ||
| const mySentence = words.join(' '); |
There was a problem hiding this comment.
could return words.join(' ') here.
| return object; | ||
| }; | ||
|
|
||
| const newUser = (name, email, password) => { |
There was a problem hiding this comment.
Creative solution. You really just need return an object.
| // sum together the likes from all the post objects | ||
| // return the sum | ||
| let total = 0; | ||
| user.posts.forEach((t, i) => { |
| const forEach = (arr, cb) => { | ||
| // iterate over arr and pass its values to cb one by one | ||
| // hint: you will be invoking cb multiple times (once for each value in the array) | ||
| arr.forEach((t, i) => { |
There was a problem hiding this comment.
For this project, you should re-create forEach.
| const addPrototypeMethod = (Constructor) => { | ||
| // add a method to the constructor's prototype | ||
| // the method should be called 'sayHi' and should return the string 'Hello World!' | ||
| Constructor.prototype.sayHi = () => { |
There was a problem hiding this comment.
This could be on one line.
| }; | ||
| }; | ||
|
|
||
| const nFactorial = (n) => { |
There was a problem hiding this comment.
This isn't recursively solved, but you're pretty close to doing it recursively.
all done 👍