Skip to content
DevMeme
198 of 7590
Languages Post #239 · source on Telegram

The Existential Crisis of JavaScript's 'this' Keyword

Description

This is a two-panel meme featuring the 'Hide the Pain Harold' stock photo character. Both panels show Harold, an older man with white hair and a beard, sitting at a desk with a laptop and holding a mug, wearing his signature pained smile. The top panel has the text overlay: 'SOMETIMES WHEN PROGRAMMING IN JAVASCRIPT I JUST WANT TO YELL "FUCK THIS"'. The bottom panel continues the thought: 'BUT I CAN'T REMEMBER WHAT "THIS" REFERS TO'. The humor is a sophisticated pun that resonates deeply with experienced developers. On the surface, it's about general coding frustration. However, the core of the joke is a direct jab at JavaScript's notoriously tricky 'this' keyword. The value of 'this' in JavaScript is determined by how a function is called (the execution context), and it can change in ways that are non-obvious, leading to countless bugs. The meme cleverly equates the developer's existential frustration with the language's own contextual ambiguity about what 'this' is at any given moment

Comments

8
Anonymous ★ Top Pick I asked my JavaScript function what 'this' was. It replied 'undefined'. I said, 'That's deep, man.' It turns out I was just in strict mode and had lost my context, again
  1. Anonymous ★ Top Pick

    I asked my JavaScript function what 'this' was. It replied 'undefined'. I said, 'That's deep, man.' It turns out I was just in strict mode and had lost my context, again

  2. Anonymous

    Twenty years in and the only stand-up worth watching is me tracing what ‘this’ resolves to after an async/await chain, a promise callback, and one stray .bind I forgot I rage-typed in 2014

  3. Anonymous

    After 20 years in this industry, I've accepted that JavaScript's 'this' is just a runtime-dependent pointer to whoever touched it last - kind of like production database credentials

  4. Anonymous

    He yelled 'fuck this' at the call site, but by the time it executed, 'this' was undefined - classic losing your context in a callback

  5. Anonymous

    After 15 years of JavaScript, I've learned that 'this' is determined by call-site, not author-time. But honestly? I still reach for arrow functions and .bind() like a safety blanket, because who has time to mentally trace prototype chains during a production incident at 2 AM when 'this' is somehow the window object again

  6. Anonymous

    I treat JavaScript’s 'this' like any external dependency: pass it explicitly - or expect a 3am page

  7. Anonymous

    JS 'this' is like microservices: every team swears it's theirs until a callback invocation proves otherwise

  8. Anonymous

    JavaScript "this": new() gives it a new identity, call/apply() forges papers, 'use strict' makes it disappear, arrow functions lexically lock it to the room

Use J and K for navigation