Convert word list into array - Javascript Array Operation

Javascript examples for Array Operation:Array Convert

Description

Convert word list into array

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <textarea id="list" placeholder="Enter your list"></textarea> 
      <script>
var textarea = document.getElementById('list');
var arr = [];//from  ww  w  .ja v a 2 s .  co m
textarea.addEventListener('input', function () {
    arr = this.value.split('\n');
    console.log(arr);
}, false);

      </script>  
   </body>
</html>

Related Tutorials