Yet Another Weird JavaScript Operator!

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • The logical OR assignment... ||= an ES 12 update in ECMAScript 2021 that looks bizarre but is another handy way to check for values before doing "x" operation. It checks to see if the thing on the left has no value (is falsy) and if so, overwrites it with the right! It's a useful way to assign a variable as long as the variable no "no value." Click subscribe to keep on top of JavaScript Tuesday and I'll see you next time!
    ES Update Playlist: • EcmaScript Updates
    Code: github.com/robertbunch/es-next
    History of ECMAScript/JavaScript (long) - • Visual Timeline of Jav...
    History of ECMAScript/JavaScript (shorter) - • Visual Timeline of Jav...
    0:00 - Introduction
    0:59 - Example
    2:25 - Truthy
    2:46 -What it really does
    3:40 - Short-circuiting
    5:15 -Doc wrap-up
  • Věda a technologie

Komentáře • 4

  • @TheJobenattor
    @TheJobenattor Před 2 měsíci +1

    You have done it once again Rob!

  • @ahmad-murery
    @ahmad-murery Před 2 měsíci

    It seems logical to me.
    Thanks Rob!

    • @robertbunch-dev
      @robertbunch-dev  Před 2 měsíci +1

      ROFL... at least they got the name right : ) It remains hard to use these two unless I force it, but maybe they will become mainstream with time!

    • @ahmad-murery
      @ahmad-murery Před 2 měsíci

      @@robertbunch-dev right :)