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

Share a tip on taking part in an organised challenge in the UK or overseas | Travel

Forget the sun lounger, more of us than ever before are signing up for trips which involve completing a tough physical challenge, whether it’s...

2026 customer service planning series: Vol. 02

When AI Agents resolve the majority of customer conversations, the shape of your support team has to change. This is part two of our five-part...

Things to distract you in November – The Bloggess

The world is hard but books are a lovely escape so here are some of my suggestions for new November releases you should read: As...

The missile meant to strike fear in Russia’s enemies fails once again

Therefore, it’s no wonder...