Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution/kevinfabian #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

keviningles2314
Copy link

creating a PR of solution of challenge 1 about callback, solucion of challenge 2 about promises using then and catch and solution of challenge 3 using async/await

Copy link

@donovanhiland donovanhiland left a comment

Choose a reason for hiding this comment

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

Hey Kevin! Nice to meet you. I'm Donovan the react team lead. I'm going to be jumping in here and there to review your challenges and help you out along the way 👋🏻

Comment on lines +41 to +61
let sucessNames = '';
let failedName = '';

for (ValidateName of names) {
validateUser(ValidateName, (error, resp) => {
if (error != null) {
if (failedName == '') {
failedName = 'Failed';
console.log(failedName, '\n');
}

console.log(error);
} else {
if (sucessNames == '') {
sucessNames = 'Success';
console.log(sucessNames, '\n');
}
console.log('Id: ', resp.id);
console.log('Name:', resp.name);
}
});

Choose a reason for hiding this comment

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

I'm thinking the question is asking for you to log every name that's not valid at the end of the function in the format User <name> is not allowed. This is close but you'll need to change a few things to get there

Copy link
Author

Choose a reason for hiding this comment

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

Hey Donovan is a pleasure to meet you and i'm really excited i will do my best and learn new things from you!

Regarding first challenge: i wanted to use the callback hell but was really frustrating, so i wanted to usea a different way to reach the answer and the final log but you are right is not valid at the end. i will takes notes about it

})
.catch((error) => console.log(error.message))
.then((name) => {
fullName.push(name);

Choose a reason for hiding this comment

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

It looks like you're pushing the last name and then pushing the full name, is that what you wanted?

Copy link
Author

Choose a reason for hiding this comment

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

In this case i checked the response and i saw that first is returning the lastname and then the first name so i need to improve my variable names to be understandable.

.join('');
//function to create a obj
const objectCreatorHandler = (productResponse, description) => {
productObject = {

Choose a reason for hiding this comment

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

I think you want a const here right? Otherwise it might do something unexpected

Copy link
Author

Choose a reason for hiding this comment

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

Yes hahaa i was checking and i believe i delete const before pushing the changes, sorry about it, i'm going to pay atention before commit any change

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.

2 participants