Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[PTMAD1018][LUCIA.CAZORLA]#697

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
DevLucia wants to merge15 commits intoironhack-labs:masterfromDevLucia:master

Conversation

DevLucia
Copy link

Aún no está terminado, con fallos.

fontcubertaand others added15 commitsJanuary 10, 2017 17:49
…one" but the test is expecting for the string itself, i change the Readme file wich is the quck fix, but may be could be good to change the spec file to not confuse the student.
…tion-fixthe test are waiting for undefined but the description says false
Copy link
Contributor

@ta-web-madta-web-mad left a comment
edited
Loading

Choose a reason for hiding this comment

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

Échale un ojo a los comentarios que te he puesto, me ha gustado que reutilices funciones y que hayas creado funciones más pequeña para hacer alguna tarea concreta. Intenta cuando puedas el último ejercicio, que es una buena práctica. Buen ejercicio, sigue así! 🌵

} else if (n1 < n2){
return n2;
} else return n1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Te sobran elelse if y el últimoelse, ten en cuenta que si no se cumple la primera condición, significará que el segundo número es mayor y, en el caso de ser iguales, puedes devolver el segundo también;

function max(a, b) {    if(a > b) return a    return b}

Si te apetece, échale un ojo a la funciónmax( ) de la claseMath, que hace justo eso, devolver el número mayor de un conjunto de números que reciba como parámetro

function averageNumbers (numbers){
var average;
if (!numbers.length){
average = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Aquí, en vez de igualar average aundefined, podías simplemente devolver nada con unreturn, eso hace que se corte la ejecución de la función y además devuelvasundefined

if (!numbers.length){
average = undefined;
} else if (numbers.length === 1){
average = numbers[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Haciendo la media no te sobraría este bloqueif? Si hay un solo elemento en el array, la media de un solo elemento es el valor de ese único elemento

average = undefined;
} else if (words.length === 1){
average = words [0].length;
} else { average = lenghtSum (words) / words.length;
Copy link
Contributor

Choose a reason for hiding this comment

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

En esta función te digo lo mismo que antes, sobre devolverundefined si el array está vacío y sobre el bloqueif que sobra cuando el array solo tiene un elemento.

function howManyTimes (words, word){
if (words.length === 0){
return false;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

La definición del bloqueelse sobra, con elreturn del if se corta la ejecución de la función si llega a cumplir la condición

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ta-web-madta-web-madta-web-mad left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

7 participants
@DevLucia@ta-web-mad@mc100s@fontcuberta@nizaroni@papuarza@HectorBlisS

[8]ページ先頭

©2009-2025 Movatter.jp