• (nodebb)

    First! First! First! Fifth!

  • Industrial Automation Engineer (unregistered)

    Probably submitted by a Lawful Good Codemonkey?

  • (nodebb)

    The usage of var fvalue=5; to break out of the loop is also interesting. Some pre-junior programmer had probably just learned about eval and loops and hacked the thing together before learning about "advanced" flow control like continue/break.

  • Long Time Lurker (unregistered) in reply to colejohnson66

    Also curious about the re-declaration of fvalue. I don't know all the ins/outs of JS scoping, hoisting, etc. for variables, but reading what appears to be a new local variable getting declared inside the do/while seems wrong. It may be "correct"/fine but IMO it should not be.

  • LZ79LRU (unregistered) in reply to colejohnson66

    Could be. Or it could be someone thinking he was clever and wanting to add a bit of flare to his code. Kind of like using goto instead of return to jump back where you came from in the good old days. And whilst we might dislike the idea on an intellectual level I know I won't be casting the first stone.

  • Carlrobert (unregistered)

    So we have fvalue == 1 or fvalue == 5 and the test fvalue < 3. Is this a new take on true, false, file_not_found meme?

  • (author) in reply to Long Time Lurker

    Ah, I meant to comment on that in the article, but was overwhelmed by the awfulness of all the rest and forgot. In JavaScript, all variables are hoisted to the function level when declared with var. The let keyword was added to support block scoping. So this would probably throw a linter complaint (hah, like they're using a linter), but runs fine and doesn't actually redeclare the variable.

  • NoLand (unregistered)

    Now I do wonder what the argument myform may actually be. Is it a string? Like "document.forms.myform"?

    It is so close and still that far at so many aspects… (There is a notion of loops, but not really. There is a notion of break conditions, but not really. There is a notion of object hierarchies, but not really. There is a notion of accessors, but not really. I stand in awe.)

  • eval("no") (unregistered)

    Maybe I'm expecting too much of this person, but surely they knew JavaScript could do this much easier (and we can at least pretend its safer too:

    window[myform][myselect].options[i];

    its still a wtf but far better than an eval(!)

  • mihi (unregistered)

    I've seen such eval things from people who were not aware that a.b and a["b"] is the same in JavaScript. Or that all global variables are inside the window object.

    Mostly people who were mainly coding in Java or C#, and had to use JavaScript snippets on the Web (as GWTand friends is too much overkill).

    Maybe, with all that node.js and serverside JavaScript, that problem will disappear eventually. But I'm not holding my breath.

  • NoLand (unregistered) in reply to mihi

    I guess, this was also some cargo cult from the kind of code DreamWeaver generated. Why DreamWeaver did so, in the first place, was always a mystery to me.

  • MaxiTB (unregistered)

    This looks like lootbox coding to me. Writing random lines of codes till the somewhat expected result pops up and then push it to master.

  • whitewalter (unregistered)

    I highly recommend https://essayshark.com/term-papers-online.html for all your college essay needs. I was in a time crunch and needed a professionally written essay, and EssayShark exceeded my expectations. The process was seamless, from placing my order to receiving a high-quality essay that was perfectly tailored to my requirements. Their team of writers knows how to create essays that truly stand out. My professor was impressed, and I received a top grade. If you want top-notch essay help, EssayShark.com is the best choice!

Leave a comment on “Evaluating Selections”

Log In or post as a guest

Replying to comment #:

« Return to Article