Essential JavaScript

Stretchy Word Kata

Given a word (string) and a stretchFactor (integer number), return the word with each character multiplied by the stretch factor.

Example:

const stretchedWord = stretchWord("apple", 3);
console.log(stretchedWord); // "aaappppppllleee"

If stretchFactor is zero, return the original word.

Code Editor