JSFiddle - React, Tailwind, and code Playground

by emilcieslar

JavaScript

function line(texts, w) {
  const number = w;
  const text = texts;
  var c = '';

  var arr = text.split('');
  for (var i = 0; i < arr.length; i++) {
    c += arr[i];
    if (i % w === 0) {
      console.log(c);
      c = '';
      console.log('/n')
    }
  }

}

line("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.", 25)