• VinDuv (disco)

    And that’s why you shouldn’t let Z80 TI-BASIC programmers touch JavaScript (or any other language, for that matter)...

  • Keith (disco)

    Surely that's the result of some minification script...

  • PJH (disco) in reply to Keith
    Keith:
    Surely that's the result of some minification script...

    .. that was then subsequently edited instead of the original?...

  • boomzilla (disco)

    Sometimes they even need to be redefined within the same function.

    But does that count when it's actually "redefined" in a function in the function? Really, is it? I don't know javascript's scoping loopiness to know. And what's the point of what it's doing? Is it really manipulating the original a that's actually in the same scope as k?

  • herby (disco)

    This reminds me of a basic program that controlled an instrument. The "author" took two PAGES of Basic to read the instrument 5 times and take the average of the middle three readings. He used only discrete variables A1 thru Z9 or some combination thereof. Never thought of arrays or loops. I can only imagine the other WTFs the code had, but I didn't look too closely for fear of a brain explosion.

  • RFoxmich (disco) in reply to PJH

    That's pretty nice formatting for a minifier-- and don't call me Shirley.

  • Medinoc (disco)

    TRWTF is the Daily WTF's website layout that robs the code sample box of a third of its width.

  • jszobody (disco)

    Looks like this article broke feedly's UI. Some of the javascript got executed presumably?

    (New user, can't upload screenshot.)

  • RandyHickey (disco)

    Congratulations on fucking up the HTML encoding. Feedly was not amused:

    [image]
  • Eldelshell (disco)

    Aren't functional PL™ nice? Nowhere else can you abuse functions in such a disastrous way.

  • Nzall (disco)

    I like how he has "DEFAULT" defined twice in succession. I wonder if any of the other 24 letters have similar issues.

  • Jaime (disco) in reply to boomzilla
    boomzilla:
    But does that count when it's actually "redefined" in a function in the function?
    Yes. Since there is no "var a" in the inner function, JavaScript looks in the containing scope.
  • TheCPUWizard (disco)

    The single character names reminds me of a developer I worked with about 20 years ago. The man really was super talented, and could squeeze the last bit of performance out of a machine [he owns many of the core gaming engines from that period]...but it code was completely unmaintainable.

    The "trick" was to keep him in a small box where the benefits of his talents outweighed the costs of nobody else being able to effectively work with his code....

  • mott555 (disco)

    Also notice there's a CSS class called JButton. I thought I'd called that one out but it must have been in an earlier draft.

  • No_1 (disco) in reply to mott555
    Comment held for moderation.
  • lystrodom (disco) in reply to Jaime

    Yes. Since there is no "var a" in the inner function, JavaScript looks in the containing scope.

    No. a is passed in as an argument to the inner function, so that's the a that's in scope. There doesn't need to be a var.

  • Jaime (disco) in reply to lystrodom

    Wrong function. The scope with the parameter is the containing scope that it looks to.

  • Jaime (disco) in reply to Jaime

    Ohhh.... it does get passed there too. It was too stupid for me to see it.

  • omnichad (disco)

    Looks like someone saw some minified code (e.g. Google) and thought that was best practice for source code.

Leave a comment on “WTF from A to Z”

Log In or post as a guest

Replying to comment #:

« Return to Article