-
Notifications
You must be signed in to change notification settings - Fork 35
it's not the fanciest code but this is my solution #3
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
base: master
Are you sure you want to change the base?
Conversation
hyfi06
left a comment
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.
Some comments
| # challenge-javascript-11 - Zero and one parents problem | ||
|
|
||
| Suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique integer identifier. | ||
| Suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of [parent, child] pairs, where each individual is assigned a unique integer identifier. |
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.
es un par ordenado (parent, child). la forma de pasarlo al JS se modela con arrays.
| return a-b; | ||
| }); | ||
| const number = [parents, oneParent]; | ||
| console.log(number); |
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.
Esto para debug está bien pero trata de limpiar tu código antes de enviarlo.
| const parents = [...new Set(parentChildPairs.map(innerPair => innerPair[0]))]; | ||
| const children = parentChildPairs.map(innerPair => innerPair[1]) | ||
|
|
||
| children.map(j => { |
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.
No estás regresando nada, usa mejor forEach. Usa nombres de variable más descriptivas.
No description provided.