Array Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Array Question

How can I take an input of a number and store each number in an array? Example Input: 5732 Array: [5, 7, 3, 2] Use this code please. It'll help me understand better. https://code.sololearn.com/Ws2iStCN8yq9/?ref=app

29th Sep 2018, 10:00 PM
Daniel Cooper
Daniel Cooper - avatar
3 Answers
+ 7
Like this? function GetArray() { var value = document.getElementById("MyInput").value; var valuesArray = value.split(""); }
29th Sep 2018, 10:15 PM
Burey
Burey - avatar
+ 2
Yep. I figured it out. For some reason, I couldn't remember split. xD
29th Sep 2018, 10:30 PM
Daniel Cooper
Daniel Cooper - avatar
+ 2
🤘
29th Sep 2018, 10:32 PM
Burey
Burey - avatar