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

Satani Kamurj (Devil’s Bridge) in Tatev, Armenia

The rugged landscapes of Armenia’s Syunik Province hold many wonders, and the Devil's Bridge is chief among them.  Located in a gorge carved by...

The Modern Job Hunt: Part 2

(Read Part 1 here) By the 10-month mark of her job search, Ellis...

The Christmas vibe shift: forget beige – the Home Alone look is all the rage | Christmas

It is December, which everyone knows is the time to get your Christmas on. So what is it to be this year? An ironic...

21 Haircare Gifts For The Hair-Obsessed Person In Your Life

This holiday season, we’ve found the gifts that feel great to get and even better to give. Shop our collection of editor-approved holiday gift guides...

Give the Gift of Convenience With the Best Smart-Home Gifts for 2025

Video doorbells are a game-changer, which is why they’re a perfect gift for those you know who would appreciate an added home safety measure....