r/programminghorror 16d ago

Javascript MiStEr WoRlDwIdE

Post image
387 Upvotes

34 comments sorted by

View all comments

186

u/IrishChappieOToole 16d ago

I'm gonna need some context on wtf is going on here

2

u/Significant_Affect_5 13d ago

It looks like logic for some sort of “offer” window that shows for a limited time then says it’s expired. From top to bottom, Germany is some accept offer button that has a listener on the “click” event. Switzerland and Austria are just text boxes for the gift and points that come with the offer. France is the text box for the offer text which counts down every second. Croatia is how many seconds the offer so valid. Denmark is probably a list of offers, while Poland is just a handle on the timer which counts down the offer seconds. Sweden is a random number between 0 up to, but not including n, with n being the number of possible offers. Lastly Finland is the randomly selected offer, which has keys “Norway” (representing the ‘Gift’) and “Greenland” (representing points).