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

‘Alicante cuisine epitomises the Mediterranean’: a gastronomic journey in south-east Spain | Spanish food and drink

I’m on a quest in buzzy, beachy Alicante on the Costa Blanca to investigate the rice dishes the Valencian province is famed for, as...

More context, more confidence: The new CX Score explained

Customer expectations have never been higher. People expect fast, accurate, and effortless support, every time. And across industries, from ecommerce to financial services to...

The NBA’s dress code was seen as policing Black culture. Instead it inspired a fashion revolution | NBA

Lonzo Ball froze in confusion. The question – “What do you think about the NBA dress code?” – hung in the air for a...

Shopping For A New Winter Perfume? These 7 Trends Will Be Everywhere

Some things remain constant every winter: no matter how prepared you are, your skin will feel the brunt of the cold, you’ll almost always...