function characterCalculator() {
let words = prompt('Put your words here: ');
if (Number(words) === 0) {
alert(' Pls, enter a correct value: ');
return characterCalculator();
} else {
return words.length;
}
}
words
за пределы цикла