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

MAD PT Cesar Aparicio#183

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
CesarAp wants to merge3 commits intoironhack-labs:masterfromCesarAp:master
Closed

Conversation

CesarAp
Copy link

(Juan Macías: ) Entrega fuera de fecha por problemas con github. Solucionado 02/11/17.

Pendiente corrección.

if (first>second){
console.log(first);
}
else ("");{
Copy link
Contributor

Choose a reason for hiding this comment

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

para los else no se necesita poner nada if(condición) { } else { }

return;
}
for (var sum=0, i=0; i <= words.length; i++) {
sum += words[i];
Copy link
Contributor

Choose a reason for hiding this comment

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

estás añadiendo la palabra a la variable sum, le estás diciendo que por ejemplo en la primera iteración "seat", sum += "0seat", luego "correspond", por lo que en la segunda iteración vale "0seatcorrespond" y así sucesivamente. Por lo que luego no puedes operar con un string

"crackpot"
];
var differ = 0;
//¿for(var i=0; esto es una variante de i = 0?
Copy link
Contributor

Choose a reason for hiding this comment

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

sí, declaras una variable para el bucle for, aquí lo que harías es sobre escribir una variable que esté por encima en el código. Siempre declaralá dentro del bucle

//¿for(var i=0; esto es una variante de i = 0?
for (i = 0; i < words.length; i++) {
if(words[i].length > differ) {
var differ = words[i].length;
Copy link
Contributor

Choose a reason for hiding this comment

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

estás volviendo a declarar la variable con el nombre differ, por lo que estás sobreescribiendo la variable de la línea 51. si quieres asignar un valor a la variable de arriba deberías hacerlo sin la palabra reservada var

for (i = 0; i < words.length; i++) {
if(words[i].length > differ) {
var differ = words[i].length;
words = words[i];
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 linea le estás diicnedo que "words" que es el array que estás iterando, vale la primera palabra del array en la primera iteración, por lo que luego el bucle iterará solo por las letras de esta palabra

"simple",
"bring"];

words = words.filter( function( item, index, inputArray ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

aquí no estás haciendo ninguna modificación, le estás pasando words, y le estás diciendo que te devuelva el mismo array, porque iterará sobre los elementos de este array uno a uno, y siempre coincide el index con la palabra buscada en el indexOf()

Copy link
Contributor

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

Choose a reason for hiding this comment

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

checked! revisa los comentarios Cesar. Ánimo!

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.

2 participants
@CesarAp@ta-web-mad

[8]ページ先頭

©2009-2025 Movatter.jp