+ 1
Use input field to get the input from the user Add a button....when clicked a function is called that will store each letter of word in an array <input type="text" id="my-text"></input> <button onclick="createArray()">CLICK</button> <script> function createArray() { var val = document.getElementById("my-text").value; var arr = []; if(val != "") { for(var i=0; i<val.length; i++) { arr.push(val.charAt(i)); } } console.log(arr); } </script>
14th Jan 2019, 11:56 AM
Rishi Anand
Rishi Anand - avatar