Skip to content

Conversation

@arepaFlipper
Copy link

No description provided.

Copy link
Collaborator

@hyfi06 hyfi06 left a 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.
Copy link
Collaborator

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);
Copy link
Collaborator

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

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.

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