November 5th, 2024
What's missing in this code?
isSmooth('Marta appreciated deep perpendicular right trapezoids');
// Expected: true (last letter of each word matches first letter of the next word)
isSmooth('Someone is outside the doorway');
// Expected: false ("e" -/> "I")
isSmooth('She eats super righteously');
// Expected: true ("e" -> "e", "s" -> "s", "r" -> "r")
isSmooth('Bold lions snarl loudly');
// Expected: false ("d" -/> "l")
isSmooth('Final step please');
// Expected: false ("l" -/> "s")
function isSmooth(sentence) {
const words = sentence.toLowerCase().
(' ');
for (let i = 0; i < words.length - 1; i++) {
const lastLetter = words
;
const firstLetter = words
;
if (lastLetter !== firstLetter) {
return false;
}
}
return true;
}
Type or select from these options