While loops w/ Strings
Recipe
Example
let word = prompt("Enter a word: ");
let i = 0; // i is the indexing variable
let size = word.length;
while (i < size) {
console.log(`Character at index ${i} from ${word} is: ${word.at(i)}`)
i++;
}Output if word was assigned to hello, world!
hello, world!Explanation
Side Note:
Last updated