JSFiddle - React, Tailwind, and code Playground

by MegaScience

JavaScript

function storeData(itemName, inputData) {
	
}

function initializeValues(itemName, type) {
	var resItem = localStorage.getItem(itemName) || null,
  	arrLen;
  if(!!resItem) {
  	switch(type) {
    	case "num":
      	arrLen = 66;
      	break;
    	case "equ":
      	arrLen = 2;
      	break;
    	case "sta":
      	arrLen = 8;
      	break;
    	default:
      	arrLen = 8;
    }
    return new Array(arrLen).fill(0);
  }
	else {
    return JSON.parse(localStorage.getItem(itemName));
  }
}

function InitialSetup(a, b) {
  if (localStorage.getItem(a) === null) {
    if (b === "num") {
      var a = 0;
    } else if (b === "equ") {
      var a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    } else if (b === "sta") {
      var a = [0, 0];
    } else {
      var a = [0, 0, 0, 0, 0, 0, 0, 0];
    }
  } else {
    if (b === "num") {
      var a = +localStorage.getItem(a);
    } else {
      var a = JSON.parse(localStorage.getItem(a));
    }
  }
}
InitialSetup('FNaFEQC', 'equ');