JSFiddle - React, Tailwind, and code Playground

by Bilal Zafar

HTML

<!--
let charCount = 0;
    let wordCount = 0;
    let arr = lines[a];
    for (let b=0; b<arr.length; b++) {
    	charCount += arr[b].length;
      wordCount = b - 1;
    }
    console.log(charCount + wordCount);-->

JavaScript

let lines = [["hello", "world"], ["How", "areYou", "doing"], ["Please look", "and align", "to right"]];
let aligns = ["LEFT", "RIGHT", "RIGHT"];
let width = 16;

justifyNewspaperText(lines, aligns, width);

function justifyNewspaperText(lines, aligns, width) {
	for (let a=0; a<lines.length; a++) {
  	console.log(lines[a]);
  }
}