JSFiddle - React, Tailwind, and code Playground

by the wazz

JavaScript

function getRecObject() {
  var recList = {};
  var recName = "someKey";
  recList[recName] = "someValue";
  return recList;
}


function getSaved(recName) {
  var recList = getRecObject();

  Object.keys(recList).forEach((key) => {
    if (key === recName) {
      console.log("recList[recName]: " + recList[recName]);
      return recList[recName];
    }
  });
}

function checkSaved() {
  var saved = getSaved("someKey");
  console.log("saved: " + saved);
  console.log("typeof: " + typeof(saved));
}

checkSaved();