r/AskProgramming • u/Tough_Pride4428 • Aug 05 '23
Unexpected function behavior
Hello, 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, the next day when I launched the script, one function stopped working completely and the other one works incorrectly. When I ran the script (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 the current version of the code, where these functions do not work properly and put the old one, where these functions worked 100%, it's the same problem. Anyone know what could have happened? I haven't changed any settings in the browser either. In that case, I would completely rule out a problem in the code.
1
u/jddddddddddd Aug 05 '23 edited Aug 05 '23
It could be a million different things. Maybe the browser cached an old version. Maybe you have changed the code and didn’t realize it. Maybe the input is different. Maybe it’s a timing or threading related issue and now something is taking slightly longer to complete which upsets something else. Maybe the browser's behavior is different or has bene updated, Etc.
…but there’s absolutely no way of knowing for sure if you’re not going to provide any code.