<input type="text" id="input">
<button id="btn">кнопка</button>
<hr>
Результат:
<p id="paragraph"></p>
var bt = document.getElementById('btn').onclick = method;
var pr = document.getElementById('paragraph');
var inp = document.getElementById('input');

var arr = [];
function method (){
  arr.push(...inp.value.split(/\s+/));
  pr.innerText = arr.join(", ");
  inp.value = "";
  console.log(arr);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.