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][PATRICIA DEFEZ]#698

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

Conversation

Patricia-Defez
Copy link

IN PROGRES

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

Choose a reason for hiding this comment

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

Revisa las anotaciones que te he ido poniendo y tenlas presentes para próximos ejercicios, ánimo y sigue así! 🌵

return a;
}else{
return b;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Elelse puedes no ponerlo y dejar directamente elreturn b,return, además de devolver contenido, termina la ejecución de una función, con lo que si entra dentro delif terminará la ejecución devolviendoa y si no, devuelveb

words.forEach (function (element) {
if (longest.length <= element.length){
longest = element;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Es correcto, peroforEach no es la mejor elección para esto,for mejor para estos casos

function calculAverage (numbersAvg){
for( i = 0; i < numbersAvg.length; i++){
resultSum += numbersAvg[i];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Podrías haber reutilizado la función de suma que declaraste justo arribasum y dividir directamente el resultado, así te ahorras volver a escribir la misma función de antes:

function calcAvg(arr) {    return sum(arr) / arr.length}

@@ -48,6 +105,16 @@ var wordsUnique = [
'bring'
];

function uniqueArr (wordsUnique){
for( i = 0; i < wordsUnique.length; i++){
var word = wordsUnique[i];
Copy link
Contributor

Choose a reason for hiding this comment

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

La creación de la variableword debería ir fuera y luego la machacas dentro del bucle con cada palabra. Esto mejor así porque no creas una variable nueva cada vez, sino que reutilizas la misma

if(wordsUnique.indexOf(word)=== 0){
wordsUnique.pop(word);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Este ejercicio no es correcto, si te ha salido bien con el array que has introducido ha sido porque se te ha dado la condición para que te salga bien. Tienes errores en varios aspectos. No debes igualar el resultado deindexOf a0 porque la coincidencia será siempre la primera posición del array, ya que es la posición 0 y la funciónpop no recibe argumentos ya que siempre elimina el último elemento del array

wordToSearch = wordToSearch.toLowerCase();
var count = 0;
for( i = 0; i< wordsCount.length; i++){
if (wordsCount.indexOf(wordToSearch, i) != -1){
Copy link
Contributor

Choose a reason for hiding this comment

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

Las igualaciones debes hacerlas estrictas, es decir!== o=== en vez de!= o==

count += 1;
}else{
count = count;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

No necesitas igualarcount = count, estás dándole el mismo valor que ya tiene. Puedes ahorrarte ese bloqueelse


function greatestProduct (matrix){
var maxProduct = 0;
for(i = 0; i === 19; i++){
Copy link
Contributor

Choose a reason for hiding this comment

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

La triple igualación en la segunda condición delfor no es necesaria, sobre todo si el límite lo hardcodeas tú misma (es decir, has escrito el número tú misma)

var maxProductIJ = 0;
for (k = 1; k === 3; k++){
if (i-k < 0){
productUp = productUp * 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Por qué le asignas aproductUp el mismo valor? ese tipo de condiciones se omiten, porque así se llena el código de líneas que no hacen nada

}else{
productRight *= matrix[i][j+k];
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Diría que te sobran 3for, de todas maneras recuerda que el producto de izquierda a derecha y de derecha a izquierda o el producto de arriba a abajo y de abajo a arriba dan el mismo resultado, así que seguro podrías quitarte 2 bloquesfor

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
@Patricia-Defez@ta-web-mad@mc100s@fontcuberta@nizaroni@papuarza@HectorBlisS

[8]ページ先頭

©2009-2025 Movatter.jp