HomeToolsAbout

String Iteration

String Iteration

Javascript

const str = "hello"; const iterableFromString = Array.from(str); console.log(iterableFromString); // Output: ["h", "e", "l", "l", "o"]
const text = "hello"; const charsArray = text.split(""); console.log(charsArray); // Output: ["h", "e", "l", "l", "o"]
const str = "hello"; const iterableFromString = [...str]; console.log(iterableFromString); // Output: ["h", "e", "l", "l", "o"]
AboutContact