task in simple terms:
There is an empty array.
There is an input and a button.

-User enters OFFER into input (For example: Hi! How are you?)
-Press the button
-In the array writes three values ​​"hello!" "how are you?" (without spaces. and preferably also without signs :), but for now at least just without spaces).

I understand how to convey a common meaning.

In principle, I understand how to transfer 1 character to values.
And how to make him understand words separately?
Thank.

    1 answer 1

    Javascript

    document.getElementById("btn_test").addEventListener("click", function() { let ar = document.getElementById("test").value.split(' '); let ar2 = ar.map(function(name) { return name.replace(/[^а-яё]/gi, ''); }); console.log(ar2); }); 
     <input type="text" id="test"> <button type="button" id="btn_test">Тест</button> 

    Jquery

     $("#btn_test").on("click", function() { let ar = $("#test").val().split(' '); let ar2 = ar.map(function(name) { return name.replace(/[^а-яё]/gi, ''); }); console.log(ar2); }); 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text" id="test"> <button type="button" id="btn_test">Тест</button> 

    Documentation:

    • one
      Yo korny babay did not pass yo ;-) - UModeL
    • one
      @UModeL updated, now everything E containing will pass) - Alex