r/programminghorror Jul 17 '26

Javascript MiStEr WoRlDwIdE

Post image
392 Upvotes

34 comments sorted by

186

u/IrishChappieOToole Jul 17 '26

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

179

u/RajjSinghh Jul 17 '26

It seems to be somewhat normal code but with all the variables being replaced with arbitrary country names. Otherwise let Finland = Denmark[Sweden]; doesn't make sense to me. The names just have no bearing to anything else.

28

u/Wooden-Contract-2760 Jul 17 '26

If that's so, what are the chances for 3 nordic countries to end up in such a short phrase, given that we see 7 non-nordic countries out of 10 on the screen?

18

u/RajjSinghh Jul 17 '26

Maybe not entirely arbitrary but definitely not geographical. Maybe geographically close countries are related data/functionality, but I don't think more than that.

Austria and Switzerland are being updated to show "points" and "gifts" which are different properties of Finland, so I don't think the choice to name things after countries has any specific meaning to the countries themselves.

2

u/Mewtwo2387 Jul 18 '26

probably because it comes from a list of countries and variable names are replaced in order according to that list, and that list put nearby countries together.

1

u/Wooden-Contract-2760 Jul 18 '26

You're telling me that Croatia -> Denmark -> Poland is matching your assumption? O.o

20

u/OhItsJustJosh Jul 17 '26

Looks like some funky obfuscation

1

u/MTT_Dylan Jul 23 '26

🎵 Won't you take me to...

2

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Jul 17 '26

I was going to ask the same.

2

u/Significant_Affect_5 Jul 20 '26

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).

183

u/Handle-Flaky Jul 17 '26

Im gonna tell my kids this was ww3

42

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Jul 17 '26

When lines 27–48 are collapsed, where's the closing square bracket?

40

u/Adept_Situation3090 Jul 17 '26

In your mind

10

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Jul 17 '26

This is hurting my brain

8

u/Adept_Situation3090 Jul 17 '26

That's the point 😉

25

u/bphase Jul 17 '26

This some weird AI humor? Doesn't really make any sense and isn't funny either?

6

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Jul 17 '26 edited Jul 17 '26

I noticed the hallmarks of AI from the emojis and surrounding text.

There are several additional things that make the code horrifying, which people haven't pointed out yet:

  • Lack of semicolons
  • Choice of font (it's still monospace)
  • Only countries from Europe

While this may be intentional horror, I'm giving OP the benefit of the doubt that the code may have been sourced from somewhere else and this person decided to leave it anonymous, as that is a recommendation from the sidebar on Old Reddit (removing references to people and companies).

I can understand lines 61–64 not being indented further because of character counts.

14

u/FM-96 Jul 17 '26

Lack of semicolons

There's nothing horrifying about not using semicolons in JS. It's just a personal style choice.

6

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Jul 17 '26

Compilers have understood no-semicolon syntax for a while. I'd say this is less horrifying than the other points.

9

u/Lewistrick [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Jul 17 '26

let Finland = Denmark[Sweden]

Now if there isn't a deeper meaning (or just a burn) behind that, I don't know

6

u/xcski_paul Jul 18 '26

I was hired as a senior programmer at a deeply dysfunctional company. Their major dysfunction is that they didn’t know how to delegate anything. One of the first things I had to do was fix some code that had been written by a summer intern who left just after I arrived. He had written a demo application in R, and the big boss had liked it wanted to turn it into a product. What nobody had told me is that nobody actually supervised the intern, and he’d written the whole thing using (and reusing) the names of Marvel characters as variable names. R is untyped, and so you were never quite sure whether “blackWidow” was an array index, or a collection of UI elements, or maybe a button click responder.

4

u/Spaceduck413 Jul 18 '26

I had a guy who wanted to write his first (very very small) script using the names of dragon ball characters for variables. I told him "it's your project do what you want."

He got about halfway through, told me "this was a bad idea" and renamed all his variables to something meaningful.

3

u/KawaiiMaxine Jul 17 '26

Offer ends in croata seconds!

3

u/firemark_pl Jul 17 '26

Why poland will be cleared again

2

u/MSR8 Jul 17 '26

which font is this?

2

u/Adept_Situation3090 Jul 17 '26

LXGW WenKai Mono TC. I picked it because of how cleanly it renders English, Chinese, AND Japanese text.

3

u/mohragk Jul 17 '26

Fun fact, in JS you can directly use elements by their id.

Example:

<!DOCTYPE html>
<html>
  <body>
    <button id="myButton">hi</button>
    <script>
        myButton.onclick = () => {
            console.log(`CLIKKK!`)
        }
    </script>
  </body>
</html>

8

u/Kitchen_Theme3514 Jul 17 '26

This is because they're attributes of the "window" global, which stores all globals. So for IDs that aren't valid identifiers, you can do window['my-invalid-identifier-id] as well!

5

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Jul 17 '26

'

4

u/Kitchen_Theme3514 Jul 17 '26

Ah yes thanks!

3

u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: Jul 17 '26

This won't work in strict mode. In these cases, I use const.