← Back to challenges

Tweaking Letters

JavaScriptHardstringsarrays

Instructions

Create a function that tweaks letters by one forward (+1) or backwards (-1) according to an array.

Examples

tweakLetters("apple", [0, 1, -1, 0, -1]) ➞ "aqold"
// "p" + 1 => "q"; "p" - 1 => "o"; "e" - 1 => "d"

tweakLetters("many", [0, 0, 0, -1]) ➞ "manx"

tweakLetters("rhino", [1, 1, 1, 1, 1]) ➞ "sijop"

Notes

Don't worry about capital letters.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.