JSFiddle - React, Tailwind, and code Playground

by Yuriy Petrichenko

JavaScript

const testFn = () => {
  let initialId
  (() => {
  return {
    const getId = () => initialId;
    const setNewId = (id) => {
      initialId = id;
    };
    return {
      getId,
      setNewId
    };
  }
  })()
};


const t  = testFn();

console.log(t);