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

‘One of the most breathtaking cathedrals in the world’: readers’ favourite churches in Europe | Cultural trips

Modernist delight in NorwayThe Tromsøysund parish church, commonly called the Arctic Cathedral, in Tromsø is a modernist delight. The simple, elegant exterior that reflects...

@bfeld v60.0 – Feld Thoughts

My father Stan and I in our default states.lsof -ti:3000 | xargs kill -9 2>/dev/null; npm run devI’ve been wandering up to 60 for...

Funniest Cat Memes I’ve Never Actually Seen That Will Now Be a Regular Part of My Everyday Texting to Friends, Family, and Coworkers

Calling all cat people! If you don't have a repertoire of go-to cat memes for your everyday texting, let us help you with that....

Just not that into ewes: ‘gay sheep’ escape slaughter and take over a New York catwalk | Fashion

When a ram tips its head back, curls its upper lip, and takes a deep breath – what is known in the world of...

Charlotte Tilbury Skincare & Makeup Bestsellers Review

So many brands use the word “airbrush” to describe their products, but few actually live up to the hype. This one does. I vividly...