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

Snowy peaks, orcas and an antique shop – the abandoned Norwegian fishing village that’s enjoying a revival | Norway holidays

We land on a white sand beach under jagged black mountains. A sea eagle, surprised to see humans, flaps away over the only house...

U.S. guided-missile cruiser spotted crossing the Panama Canal after warships deployed to Venezuela

A U.S. guided-missile cruiser, USS Lake Erie, was seen crossing the Panama Canal from the Pacific to the Caribbean on...

I think I’m doing birds wrong – The Bloggess

I have always been lightly obsessed with birds, and it’s gotten worse as I’ve gotten older, which I can only assume is another sign...

Home, Fashion & Beauty Deals

Your Labor Day sale countdown is officially on. With the long weekend finally here, it's time to stock up on, well, everything. Think: transitional-weather...