• Sunday , 15 October 2017

var, let and const – What, why and how – ES6 JavaScript Features

Code Canyon



In ES5, we only had one type of variable, var, but in ES6, we have three. types of variables: var, let and const. In this video, we explore the what, why, and how of var, let and const, and I also do a little lecture on the value of minimising mutable state.

► 00:35 var keyword in JavaScript
► 02:35 Immediately-Invoked Function Expression (IIFE) in JavaScript
► 03:14 hoisting variables in JavaScript
► 08:29 let keyword in JavaScript
► 11:55 const keyword in JavaScript
► 14:14 Minimize mutable state when programming

I’m also active on:
– Twitter https://twitter.com/mpjme
– Medium https://medium.com/@mpjme
– Quora https://www.quora.com/profile/Mattias-Petter-Johansson

Resources:

– Semicolons cannot save you! (Another funfunfunction video)

– ES6 JavaScript Features (Playlist of this series)


Original source

3d Ocean

Related Posts

20 Comments

  1. Aloa1547
    May 19, 2017 at 09:38

    13:31
    x.z= 99 also works, so adding new attributes works but replacing a whole const (like x ={ y: 3}) doesn't work (like you showed)

    Anyway good video, keep going 🙂

  2. Augustin Bralley
    May 19, 2017 at 09:38

    Check out AntiRSI… it's helped me a lot with body pain while working.

  3. James McGinn
    May 19, 2017 at 09:38

    "It's so nice for something to be immutable." Great explanation. I loved the dishwasher analogy. Thank you!

  4. MarioTHROWSfireBalls untitled
    May 19, 2017 at 09:38

    To use ES6 do I need to download something

  5. shitijgupta29
    May 19, 2017 at 09:38

    Your videos are addictive. 🙂

  6. HardwareAddiction
    May 19, 2017 at 09:38

    This explanation is not that straight forward. It is concluded the issue LET solves is basically, just the closure overhead. I read variables declared with LET are not hoisted within a block and therefore an exception is thrown if used before declaration, so that's another benefit (because it forces you to code predictably), but are there any other benefits I might be missing here?

  7. ThirdCultureRecords
    May 19, 2017 at 09:38

    Yo I had terrible tendonitis from playing guitar. 'Active release therapy' is the only thing that worked. Deep massage and breakup of scar tissue. Worth checking out. Fantastic vid btw!

  8. Rob Bradshaw
    May 19, 2017 at 09:38

    Hey man, regarding your arm pain (RSI) have you tried using a magic trackpad 2? I find that it helps with hand ergonomics. I've just started using one myself 🙂 It just seems nicer because your fingers and hand can essentially remain flat and not curved over the traditional mouse. ( and i have many, many different types of mice! from magic mouse, to microsoft sculpt keyboard/mouse, razer, logitech gaming mice etc)

  9. Sam Guliker
    May 19, 2017 at 09:38

    Hee!

    I found out that Yoga works a lot for me. While I'm studying computer sciences accuires to sit around a lot the body is out of balance.I hope this helps, thanks for the great videos, keep them coming!

  10. Daniel Bonnells
    May 19, 2017 at 09:38

    I need semicolons!!! You're stressing me out.

  11. vladanng
    May 19, 2017 at 09:38

    When he is making video 20 minutes length, you know you will watch it for one hour, not because of looking to understand problems and various situations, , but looking his facial expresions, movement, voices and shouts and constantly repeting them. Yes.

  12. Savita Pandit
    May 19, 2017 at 09:38

    Loved your way of teaching 🙂

  13. kaosmentalgeral
    May 19, 2017 at 09:38

    I also have problems with this type of pain. What I started doing is switching the mouse hand from time to time. At first it is REALLY hard to use it with the other hand (but I had no choice, was finnishing my masters and had to keep writting my dissertation and coding). But nowadays I can use both hands
    with the same speed.

    I also noticed that puting my chair higher helped.

    Good luck!

  14. Patrick Barnes
    May 19, 2017 at 09:38

    Just discovered you today and can't stop watching. Great content and humor! Concerning arm pain: I had this and it was due to clicking on mouse buttons. Makes sense that extending a finger and mashing a button hundreds of times a day would cause RSI. Problem went away quickly and has stayed away for years when I replaced the mouse with, first, a Wacom tablet and later a magic track pad with tap to click enabled.

  15. Mohamed Ahmed
    May 19, 2017 at 09:38

    Wow! your hair grow a lot since last week.

  16. Sunil Sandhu
    May 19, 2017 at 09:38

    Subscribed to your channel after coming across this video – super educational, super entertaining and supremely accessible – you the funkiest!

  17. Zhi Li
    May 19, 2017 at 09:38

    Nice hair dude!!

  18. Floriaan vD
    May 19, 2017 at 09:38

    Great video sir! in terms of ergonomics: i used to experience what you described on a daily basis previously.
    What fixed it for my was: Have a chair which has a good straight sit mode (not hanging back nor too forwards) and make sure that your chair has armrests where your elbow can rest at height of about 2/3cm lower than your desk height.
    Also what is essential is using a mouse that suits your hand. It would shock you to know how many people use too small mice.
    A nice long mouse ergonomics wise is the Razer Deathadder.

    Again thanks for making these awsome video's for new aspiring JS devs and i hope your arm is okay again by now!

  19. Teyden Nguyen
    May 19, 2017 at 09:38

    "15:20 fucked up some set of inputs some timing in some consolation made one variable be" …

    Where you said that "one variable got set before one other" and the program got fucked up, but same inputs and same expected outputs. Since it's not user error… is it then, the issue of the written JavaScript program, or is it the JavaScript interpreter that messed up?

  20. Teyden Nguyen
    May 19, 2017 at 09:38

    you're quirky and funny. i'm going to subscribe.

Leave A Comment

You must be logged in to post a comment.