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

Wat Pho Reclining Buddha in Bangkok, Thailand

The reclining Buddha is 46 meters long (about 150 feet) and gold-plated, and represents the Buddha entering complete spiritual enlightenment. The soles of...

Accountant warns daughter of her boyfriend’s risky real-estate venture, but warnings backfire as she claims that his “professional concerns” are perceived as personal judgment:...

Mixing work and personal life is already a risky approach, but when you bring your partner and your father into the mix, you're just...

‘Stranger Things’ Lets It Rip to Kick Off Its Final Season

The conclusion to Netflix and the Duffer Brothers’...

ETHAN HAWKE Compares His THE LOWDOWN Character to a Raccoon Eating a Burnt Marshmallow, Talks The Ease of Working w/ Peter Dinklage and More,...

Had a great conversation with Ethan Hawke on TV Topics podcast about some of the best work of...