JSFiddle - React, Tailwind, and code Playground
by Maxim_Wolf
JavaScript
let counter = 0;
export const inc = ()=>{
const temp = counter +1;
if(temp > 100){
throw new Error();
}
counter = temp;
}
export const dec = ()=>{
const temp = counter -1;
if(temp < 0){
throw new Error();
}
counter = temp;
}
export const get = ()=>{
return counter;
}