You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to pass all the test yet crash the server one using the poemWriter a second time.
On solutions that do not check to see with the poem is three lines long before validating the amount of word per line. So on any poem tested after the first initial poem the server will crash when code simillar to this is ran
@gj
It is possible to pass all the test yet crash the server one using the poemWriter a second time.
On solutions that do not check to see with the poem is three lines long before validating the amount of word per line. So on any poem tested after the first initial poem the server will crash when code simillar to this is ran
`function countWords(line) {
return line.split(' ').filter(l => l).length;
}
function isValidPoem(poem) {
const poemLines = poem.split('\n').filter(l => l);
const isRightAmountOfLines = poemLines.length === 3;
const hasRightAmountOfWords = countWords(poemLines[0]) === 5 && countWords(poemLines[1]) === 3 && countWords(poemLines[2]) === 5;
return isRightAmountOfLines && hasRightAmountOfWords;
}`
It seems when poem is passed the second time it has now length therefore crashing the server.
The text was updated successfully, but these errors were encountered: