12
SHA-16384
15d

Someone wrote out html markup, where each element of the markup is a string in an array. Then this mess is joined using '' all wrapped by jquery $( ... ).

What the 💩.

Like:

var iDontGiveAFuck = $( [
'<span class="bullshit">Copied from stack overflow',
'<a href="/some/more/bullshit.lol">I\'m an overachiever</a>',
'</span>'
].join('') );

Except theirs is like 40 lines of this.

THIS IS WHAT TEMPLATES ARE FOR.

I'm outside channeling my aneurysm into an anime ball of energy I'll release when the time is right (never).

Comments
  • 2
    Rolling out a dynamic template with Jquery! Genius, why haven't I thought of this!
  • 1
    @Ubbe Because it's terrible?
  • 3
    @powerfulparadox That could be it!
  • 2
    An aphorism I invented (at least I've never encountered anyone else who said anything like it) is, "for any problem there exists a simple but highly impractical solution." (Usually it is highly entertaining to suggest and watch people's reactions.) A corollary could be demonstrated here... that impractical solutions can also be complicated.
  • 0
    I can't imagine what this could possibly be.
  • 2
    Template strings are quite new in JS and if you want to avoid the headaches of transpiling / polyfills, ultra bloat, etc then you might stick to old school JS.

    People do stuff like this because JS strings don't usually accept new lines and generally make for a lot of ugly.
Add Comment