I know that in javascript it is possible to have a string and then put it into an array:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Break a string and convert it into an array of words.</title>
</head>
<body>
<script>
var str = "there is a cat with a lack of dog in the attic";
var words = str.split(" ", 10);
for (i=0; i<words.length; i++){
console.log(words);
}
</script>
</body>
</html>
I know how to get input from a text box, but I do not know how to break the string from that input into array.
I would like to be able to do the same as the code above, preferably rbe able to set a limit as well, in my example, it is 10.
In the end I would like to store each sentence as a different array, so I imagine I will have one array
and I would be filling it with arrays deriving from strings coming from the input.
How can I achieve all that, perhaps i might be able to figure out storing these arrays but i am already blocked, because i do not know how to convert a string into array in the first place, just like described above, but in construct.
Thank you in advance!