Workshop › Text detective › Step 11 of 13
caesar goes through a text letter by letter, shifts each one and glues them together.
```js
function caesar(text, shift) {
let secret = ''
for (const letter of text.toLowerCase()) {
secret += shiftLetter(letter, shift)
}
return secret
}
```secret starts empty and grows by one letter each turn (+= adds to the end).for...of over a text visits it one character at a time.shiftLetter: small functions build bigger ones.Write caesar under shiftLetter.
Skills: Loops, Functions
← Shift a letter The secret line →