JavaScript Teaser: Awful Functions

Written by
Date published
May 15, 2015

Here is our JavaScript Teaser for May 14, 2015. Can you solve it?

What does this function return and why?

function awful() {
  function terrible(x, y, z) {
    return x;
  }
  terrible[0] = 'this';
  terrible[1] = 'is';
  terrible[2] = 'pretty';
  terrible[3] = 'terrible!';
  terrible.length = 4;
  return [].map.call(terrible, terrible).join(' ');
}

Please post the answer on JSFiddle or similar service, and then post a link to your answer here. You can also post comments below or email Rangle.io's CTO, Yuri@rangle.io, if you wish to share further ideas.

Tags

See what Ranglers are writing about on our blog