var, let, and const: What is the Big Difference!

Sdílet
Vložit
  • čas přidán 6. 09. 2024

Komentáře • 2

  • @darkandblue4118
    @darkandblue4118 Před 7 měsíci

    I wonder if there is a performance difference between let and const. (But I guess the virtual machine could optimize them at runtime too)
    Also it would be interesting if using "let" which has only 3 letters makes pages load faster because "const" has 5 letters and takes up more space when transferring the pages content.

    • @FloWoelki
      @FloWoelki  Před 6 měsíci

      Interesting thought! Indeed there are some benchmarks: www.oreilly.com/library/view/learn-ecmascript/9781788620062/a9c74687-660d-4908-a44d-e9e0c3c4eeea.xhtml
      But nowadays, the JS engines are incredibly smart and they can often optimize the use of `let` and `const` so that there's negligible performance difference between them. However, the modern JS engines focus more on improving `let` and `const`.