JSFiddle - React, Tailwind, and code Playground

by Anand Chowdhary

HTML

<p>Loading...</p>

CSS

body {
  word-break: break-all;
  font: menu;
  font-size: 110%;
  padding: 2rem;
}

JavaScript

const result =
  // Create a new empty array with 0-99
  Array(100).fill()
  // Add 1 to values to make an array with 1-100
  .map((_, i) => i + 1)
  .map(n => {
    // If multiple of both
    if (n % 2 === 0 && n % 5 === 0) return "LeasePlan";
    // If multiple of 2
    if (n % 2 === 0) return "Lease";
    // If multiple of 5
    if (n % 5 === 0) return "Plan";
    // If not a multiple of 2 or 5
    return n;
  })
  // Separate by commas
  .join()
;

const p = document.querySelector("p");
p.innerHTML = result;