JSFiddle - React, Tailwind, and code Playground

by PARK KYUNGSIK

HTML

<div></div>

JavaScript

const max = 9;
const s = 'F' == 'F' ? 2 : 3;
const a = 53;
const m = 7;
const d = 11;
const t = 10;

let this1Cy = 0;
let this1Cm = 0;
let this1Cd = 0;
let this1Ct = 0;
let this3Cy = 0;
let this3Cm = 0;
let this3Cd = 0;
let this3Ct = 0;
let thisY = 2024;

let idx = s;
this1Cy = loop('a', a);
console.log(this1Cy);

idx = this1Cy + 1;
this1Cm = loop('m', m);
console.log(this1Cm);

idx = this1Cm + 1;
this1Cd = loop('d', d);
console.log(this1Cd);

idx = this1Cd + 1;
this1Ct = loop('t', t);
console.log(this1Ct);

$('div').html($('div').html()+ this1Cy +','+ this1Cm +','+ this1Cd +','+ this1Ct);
$('div').html($('div').html()+'<br/>');

idx = this1Cy;
this3Cy = loop('a', a);
console.log(this3Cy);

idx = this3Cy;
this3Cm = loop('m', m);
console.log(this3Cm);

idx = this3Cm;
this3Cd = loop('d', d);
console.log(this3Cd);

idx = this3Cd;
this3Ct = loop('t', t);
console.log(this3Ct);

$('div').html($('div').html()+ this3Cy +','+ this3Cm +','+ this3Cd +','+ this3Ct);

calcFuture();

function loop(flag, cnt) {
  for(let i=1; i<=cnt; i++) {
    if(max < idx) {
      idx = 1;
    }

    if(cnt > i) {
      idx++;
    }
  }
  
  return idx;
}

function calcFuture() {
  for(let i=1; i<=9; i++) {
    $('div').html($('div').html()+'<br/><br/>');
    let f1C = '';
    idx = this1Cy;
    f1C += loop('a', (i+1)) +',';
    idx = this1Cm;
    f1C += loop('m', (i+1)) +',';
    idx = this1Cd;
    f1C += loop('d', (i+1)) +',';
    idx = this1Ct;
    f1C += loop('t', (i+1));
    
    let f3C = '';
    idx = this3Cy;
    f3C += loop('a', (i*2+1)) +',';
    idx = this3Cm;
    f3C += loop('m', (i*2+1)) +',';
    idx = this3Cd;
    f3C += loop('d', (i*2+1)) +',';
    idx = this3Ct;
    f3C += loop('t', (i*2+1));
    
    $('div').html($('div').html()+ f1C +'<br/>'+ f3C);
  }
}