Split string into array
Use the .split()
method. When specifying an empty string as the separator, the split()
method will return an array with one element per character.
entry = prompt("Enter your name")
entryArray = entry.split("");
ES6 :
const array = [...entry]; // entry="i am" => array=["i"," ","a","m"]
use var array = entry.split("");