How to show results from this function to HTML? (input in textarea)?

How to show results from this function to HTML? (input in textarea)

function chunkIt(str,chunk) {
  var words = str.split(" ");
  var arr = [];
  for (var i = (chunk - 1); i < words.length; i++) {
    var start = i - (chunk - 1);
    arr.push(words.slice(start, start + chunk));
  }
  return arr.map(v => v.join(" "));
}  


var test = "I love you so much, but Joe said \"he doesn't\"!";
console.log(chunkIt(test,2));
console.log(chunkIt(test,3));
console.log(chunkIt(test,4));'

Welcome Ivke.

I have edited your post for readability. Please put your code in backticks. Note: backticks ` are not the same as apostrophes '.

1 Like

Thank you very much. I updated code .But do not work https://codepen.io/drago-ivan/pen/yLybXqN