value in first function (like a number) each time this function is called in the second function.
Is there a way to find out if a function or variable is called some where else in the code ?
I know we can find out by handling it in the second function, but wanna know if there is another way of know if a function is called?
No, which is why globals are a terrible thing
not this... never this
Sorry didn't get
This is a problem you should never have lmao
Explain what you actually want to do that you think needs this
Maybe this is what you want? const makeCounter = () => { let n = 0; const read = () => n; const inc = () => { n++; }; return { read, inc }; }; const { read, inc } = makeCounter(); read(); // 0 inc(); inc(); inc(); read(); // 3
Обсуждают сегодня