r/learnprogramming • u/Tough_Pride4428 • Aug 04 '23
Unexpected function problem.
I have a small problem that I create a project in js, css, html, which is launched locally in the browser and when everything I did last worked normally, when I launched the script the next day, one function stopped working completely and the other one works incorrectly. When I ran the script (the current version) the next day, I did not modify these functions in any way, I did not change their calling context, nor did I change other functions that affect them in any way. The console in the code editor as well as in the Chrome browser does not have a single syntax error, etc. I always make copies of the entire script so that I can restore something if I messed up in the current version, or I would like to restore something as I did in the previous version. In these older copies, these functions worked normally, nothing happened, now if I remove this current version of the code and put the old one, where these functions should work, it's the same problem. Anyone know what could have happened? I haven't changed any settings in the browser either. In this case, it can't be a problem with the code, but with something from the outside.
1
u/lurgi Aug 04 '23
Could be a caching issue. It's possible that the code you were actually running yesterday is not the code you thought you were running.
My advice is to forget that it used to work and focus on what you have now (and use source code control, for Zod's sake). You have code that doesn't work. Debug it. I've been in the situation of "this used to work" quite a few times in my career and I can honestly say that trying to work out why it used to work has never been helpful. Memory is faulty and computers are weird. Focus on what you've got.