The Right Helper – The Daily WTF

Date:

Share:

Greg was fighting with an academic CMS, and discovered that a file called write_helper.js was included on every page. It contained this single function:

function document_write(s)
{
   document.write(s);
}

Now, setting aside the fact that document.write is one of those “you probably shouldn’t use this” functions, and is deprecated, one has to wonder what the point of this function is. Did someone really not like object-oriented style code? Did someone break the “.” on their keyboard and just wanted to not have to copy/paste existing “.”s?

It’s the kind of function you expect to see that someone wrote but that isn’t invoked anywhere, and you’d almost be correct. This function, in a file included on every page, is called once and only once.

More like the wrong helper, if we’re being honest.

Source link

Subscribe to our magazine

━ more like this

International Vinegar Museum in Roslyn, South Dakota

Billing itself as "the world's first and only museum dedicated to the wonder that is vinegar," the International Vinegar Museum first opened its...

Second IC :) – Sam Zeloof

Homemade 1000+ transistor array chip  In 2018 I made the first lithographically fabricated integrated circuits in my garage fab. I was a senior in high school when I...

21 Wild Pictures of Cats Pawtying Through Caturday Night

Cats go absolutely feral when Caturday night rolls in. The moment it gets dark, they decide it's time for a full-blown house party no...

These Noise-Canceling JBL Headphones Are Nearly Half Off Right Now

We may earn a commission from links on this page. ...