Skip to content

Commit

Permalink
Corregi nuevamente la funcion getAverageWordLength
Browse files Browse the repository at this point in the history
me estaba devolviendo dos decimales pero al correr el test salia error
entonces probe con otra funcion y esta vez si corrieorn los test de
manera correcta .
  • Loading branch information
AGonzalesHuamani committed Jan 6, 2024
1 parent f744067 commit 4fd1b20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const analyzer = {
suma += word[i].length;
}
const getAverageWordLength = suma / word.length;
return getAverageWordLength.toFixed(2)
return Math.round(getAverageWordLength*100)/100;
},

};
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const characterCount = document.querySelector("li[data-testid='character-count']
const characterNoSpaces = document.querySelector("li[data-testid='character-no-spaces-count']");
const numberCount = document.querySelector("li[data-testid='number-count']");
const numberSum = document.querySelector("li[data-testid='number-sum']");
const wordLengthAverage = document.querySelector("li[data-testid='word-length-average']";
const wordLengthAverage = document.querySelector("li[data-testid='word-length-average']");

const resetButton = document.getElementById("reset-button");
resetButton.addEventListener("click", function limpiar() {
Expand Down

0 comments on commit 4fd1b20

Please sign in to comment.