Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@aaren-george
Copy link

all done 👍

MuraraAllan and others added 12 commits July 11, 2017 18:18
updated the FizzBuzz code
updated problems
Refactored to use ES6 single-line functions where necessary.
udated project 3
completed all probelms except bonus question
re-structured the code based on the solutions lecture
Copy link
Contributor

@taithethai taithethai left a comment

Choose a reason for hiding this comment

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

Overall good clean code. Just a few improvements to be made.

// 'hello world' -> 'hello world!'
// code here
};
const combineNames = (firstName, lastName) => firstName + ' '.concat(lastName);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use template literal here.

// 'Lambda', 'School' -> 'Lambda School'
// code here
};
const getGreeting = name => 'Hello '.concat(name).concat('!');
Copy link
Contributor

Choose a reason for hiding this comment

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

You could use template literal here.

return result;
};

const isPrime = (num) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Prematurely returning.

} return false;
};

const returnFirst = (arr) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

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(' ');
Copy link
Contributor

Choose a reason for hiding this comment

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

could return words.join(' ') here.

return object;
};

const newUser = (name, email, password) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

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) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could reduce here.

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) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

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 = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be on one line.

};
};

const nFactorial = (n) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't recursively solved, but you're pretty close to doing it recursively.

@taithethai taithethai closed this Aug 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.