Skip to content
DevMeme
3928 of 7590
Languages Post #4275 · source on Telegram

Yoda on Modern JavaScript: The Var Awakens No More

Description

This meme features a still image of the wise and pensive character Yoda from Star Wars. Above his head is a text overlay presented as a quote: '"let or const. There is no var." -Yoda'. This is a clever parody of Yoda's famous line, 'Do or do not. There is no try.' The joke directly maps this iconic philosophical advice to a modern JavaScript best practice. In contemporary JS (ES6 and beyond), 'let' and 'const' are the preferred keywords for variable declaration due to their block-scoping and immutability features, respectively, which prevent common bugs associated with the older, function-scoped 'var'. For experienced developers, this meme is a humorous nod to the evolution of the language and the dogmatic adherence to new standards, framing the abandonment of 'var' as a matter of Jedi-like discipline and wisdom

Comments

26
Anonymous ★ Top Pick Using 'var' in a modern codebase is a pathway to many abilities some consider to be unnatural, like hoisting bugs and scope pollution
  1. Anonymous ★ Top Pick

    Using 'var' in a modern codebase is a pathway to many abilities some consider to be unnatural, like hoisting bugs and scope pollution

  2. Anonymous

    Yoda’s right: choose let or const; var is the Phantom Menace of JavaScript - hoisted, over-scoped, and guaranteed to make your future self stare at the diff like Obi-Wan watching Anakin become technical debt

  3. Anonymous

    After 15 years of debugging production issues caused by var's function-scoping and hoisting quirks, senior engineers have achieved Jedi-level enlightenment: the real dark side isn't the Sith, it's explaining to a junior why their for-loop iterator just leaked into global scope and overwrote the CEO's dashboard metrics

  4. Anonymous

    Nine hundred years of hoisting bugs has Yoda seen; function-scoped, his patience is not

  5. Anonymous

    Yoda's wisdom transcends galaxies: in modern JavaScript, 'var' is as outdated as using the Force without proper error handling. Experienced engineers know that 'let' and 'const' aren't just syntactic sugar - they're essential for avoiding the hoisting nightmares and function-scoped chaos that haunted pre-ES6 codebases. Block scoping and immutability by default? That's the path to maintainable code, young Padawan. The real Jedi move is defaulting to 'const' unless reassignment is truly necessary, because mutation leads to bugs, bugs lead to debugging sessions, and debugging sessions lead to suffering

  6. Anonymous

    Write var and you summon the dark side of hoisting; let/const and the temporal dead zone keep your for-loop callbacks from all believing i = 10

  7. Anonymous

    Yoda gets it: 'var' hoisting is the dark side that turns local vars into global nightmares

  8. Anonymous

    ‘var’ is basically a production incident dressed as a keyword - function‑scoped, hoisted, and guaranteed to violate your SLOs; use let/const you must

  9. @Agent1378 4y

    Is this some JS meme?

  10. @mr_oz 4y

    It’s russia meme, because if you say war you go to jail for 15years

    1. @lovetraindriver 4y

      Heh.

    2. @zexUlt 4y

      You should now say "vvar"

      1. @mr_oz 4y

        I am can say all I want because I leave in democratic country not in russland

        1. @RiedleroD 4y

          *russia

          1. @mr_oz 4y

            Fckrussia

            1. @sylfn 4y

              Fuck-ussia* [Please use English here]

              1. @mr_oz 4y

                Updated)

    3. @thematdev 4y

      it is not true

  11. @asm3r 4y

    Function- var. Class - let. You should know how var works even in 2022

    1. @RiedleroD 4y

      function a(){ let x = 2; return x; }

      1. @asm3r 4y

        Where a visible?

        1. @RiedleroD 4y

          idk, globally?

          1. @asm3r 4y

            Yep, you don't know var scoping

            1. @RiedleroD 4y

              never said I did lol I hate js with a passion

    2. @azizhakberdiev 4y

      Xcuse me, what the fuck?

      1. @asm3r 4y

        Programming.

Use J and K for navigation