-
Notifications
You must be signed in to change notification settings - Fork 26
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
base: master
Are you sure you want to change the base?
Solution/kevinfabian #9
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 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 👋🏻
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); | ||
} | ||
}); |
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'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
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 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); |
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.
It looks like you're pushing the last name and then pushing the full name, is that what you wanted?
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.
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 = { |
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 think you want a const here right? Otherwise it might do something unexpected
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.
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
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