How to take input of words using javascript?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
12 views


Input's in e there are words I need to take it 1 word.
For example the word world.
How to implement it?
by | 12 views

2 Answers

0 like 0 dislike
//find the input let domInput = document.querySelector('selector-to-find-need-input'); //get the string written in the input let strInputText = domInput.value; //splitting a string into words let arWords = strInputText.split(' '); //Now the array arWords each element is a separate word from those that were in the input arWords.forEach(function (word) { alert(word); })
by
0 like 0 dislike


var arrayOfStrings = document.getElementById("myText").value.split(" ");


View in the debugger, what will be the result. You have not provided the criteria by which you need the word world. Any second? Or what?
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users