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

13 Wedding Guest Dresses You'll Want to Wear on Repeat, Including Sydney Sweeney's

It's no secret that getting a gorgeous letter-pressed wedding invitation in the mail brings immediate excitement. Your eyes quickly scan the location and before...

Analog(ue) #217: You Don’t Deserve Me at My Periscope

#217: You Don't Deserve Me at My Periscope September 10th, 2023 · 97 minutes September is upon us, and you know what that means! Also, let's reflect on...

‘The White Lotus’ Cast Members Are All Paid the Same Amount, Producer Reveals

In an interview with The Hollywood Reporter, “The White Lotus” producer David Bernad revealed that the acclaimed...

What Secrets Are Behind the Magic of Miniatures? AO Wants to Know.

AO Wants to Know is an ongoing interview series where we ask...