JavaScript Let, Const & Var: A Complete Guide

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024

ความคิดเห็น • 186

  • @sarthakgaba1583
    @sarthakgaba1583 4 ปีที่แล้ว +102

    Thank you Colt, I just completed your web dev bootcamp on Udemy, that was an amazing course!

    • @cq7499
      @cq7499 4 ปีที่แล้ว +4

      I'm studying now, haha

    • @prateeksingh4491
      @prateeksingh4491 4 ปีที่แล้ว +2

      Yes bro, it's an amazing course!!

    • @focus-freaks
      @focus-freaks 4 ปีที่แล้ว +7

      i just started javascript in the course and upto now
      it's awesome.

    • @artemis8342
      @artemis8342 4 ปีที่แล้ว +1

      ....

    • @reilly2676
      @reilly2676 4 ปีที่แล้ว +2

      Artemis why the ...?

  • @melissaginoza2926
    @melissaginoza2926 4 ปีที่แล้ว +25

    Thank you for the detailed information. I came from your Bootcamp

  • @kirose
    @kirose 4 ปีที่แล้ว +2

    Just wanted to say that your course on Udemy is the most helpful learning resource I've found for html, css, and now javascript. Thank you for all the effort you've put into keeping the lessons relevant and up to date.

  • @compskilllimited-softwaret5864
    @compskilllimited-softwaret5864 3 ปีที่แล้ว +1

    Sounds so simple when you describe things this way. Thank you

  • @dwighthayles1226
    @dwighthayles1226 4 ปีที่แล้ว +2

    Hi Colt, Thank you for this! I'm working on your bootcamp for web developers and thanks to this course I'm getting a grasp of basic concepts. Keep up the good work!

  • @carmelomiuccio1658
    @carmelomiuccio1658 4 ปีที่แล้ว +1

    Hi Colt! I'm following The Web Developer Bootcamp , you're the best tutor ever man , thanks for what you're doing!

  • @RurouniKenshinShinta
    @RurouniKenshinShinta 3 ปีที่แล้ว

    Thanks for clarifying in detail the difference between these. Been bouncing around between them for a while never really understanding the difference in any way shape or form. I always just was under the assumption that it was a matter of preference. You clarified this like a BOSS, dude!

  • @anaavg
    @anaavg 4 ปีที่แล้ว +4

    Colt, you are awesome. Thank you for sharing your knowledge with everyone!

  • @picosofamoso33
    @picosofamoso33 ปีที่แล้ว

    Thanks for your videos Mr. Steele on TH-cam and Udemy.
    I've been a student on Udemy for years now and I highly recommend your web developer bootcamp course to any beginner that is looking to learn how to build websites. Not only is it loaded with easy to learn programming but you make it fun, thanks!

  • @MM-oq1lb
    @MM-oq1lb 3 ปีที่แล้ว

    It's the 8th video on YT I'm starting to watch and looking for another one because as usual dudes are talking to other dudes that know already. There are no beginner videos for me. Your glasses are fine.

  • @ebenezerangel6567
    @ebenezerangel6567 4 ปีที่แล้ว

    Thank you so much.now i'm clear with using var,let,const

  • @truefriend3575
    @truefriend3575 4 ปีที่แล้ว +1

    Colt Steele....Thanks so much for your effort....bro i am so happy that i can learn from you...it is so well made.....thanks once again.....

  • @Batsnang
    @Batsnang 4 ปีที่แล้ว

    Came here from section 10 of the Bootcamp, thanks for keeping it updated and applicable!

  • @pranitraj7701
    @pranitraj7701 3 ปีที่แล้ว

    Now that was a pretty cool introduction to start with. Really liked that beyond convincing style till 0:16

  • @aprodan5245
    @aprodan5245 5 ปีที่แล้ว +56

    Rusty is back!

  • @csokan.palandras
    @csokan.palandras 4 ปีที่แล้ว

    Hi! I'm here from the Udemy course to update the information from "var" to "let" and "const". Great course! Thanks. Cheers.

  • @t.roll21
    @t.roll21 2 ปีที่แล้ว +2

    Hey Colt!
    Gotta say that I absolutely looooove your webdev bootcamp on udemy!
    You rock man, I'm a huge fan of your teaching style - and, most importantly - your personality :)
    Your sense of humor is awesome, you have me cracking up every few videos XD
    Anyways, G-d bless you man! may you prosper in all of your endeavors ;)
    Keep "doin your thing" bro ;-D !
    Much gratitude for all that you do

  • @mikeygarcia8597
    @mikeygarcia8597 4 ปีที่แล้ว

    Let, Const and Var and the quest for the holy script! Great class really digging it.

  • @shehreensaifi846
    @shehreensaifi846 4 ปีที่แล้ว +1

    thanks colt......i enjoyed your web dev bootcamp on udemy...nice explanation

  • @SergioArroyoSailing
    @SergioArroyoSailing 4 ปีที่แล้ว

    great video explaining the subtleties! didn't know about the re-declaration ! thanks

  • @sharonng6442
    @sharonng6442 3 ปีที่แล้ว +1

    Thank you Colt for the series of JS, HTM: & CSS classes on TH-cam! You should go on eDX!

  • @rovatk373
    @rovatk373 5 ปีที่แล้ว +278

    Didn't know Tom Holland was a programmer

    • @GALAXYXD
      @GALAXYXD 4 ปีที่แล้ว +43

      In fact, he likes to be a WEB developer

    • @tamcor7576
      @tamcor7576 4 ปีที่แล้ว +2

      lol

    • @MogalMauli
      @MogalMauli 4 ปีที่แล้ว +3

      @@GALAXYXD underated comment 😂

    • @soniauduma1640
      @soniauduma1640 4 ปีที่แล้ว +1

      he is a WEB developer

    • @brainsnackstore
      @brainsnackstore 4 ปีที่แล้ว

      😂😂

  • @klementynakwiatkowska986
    @klementynakwiatkowska986 4 ปีที่แล้ว +19

    I like your glasses! Just wanted to say I really appreciate the content you make, I have two of your udemy courses which are really valuable. I was actually able to secure a place on a master of data science and artificial intelligence following your courses (and of course hours of individual study), so I just wanted to take a minute to say thank you for creating opportunities to learn and develop new skills.

    • @kzmOP
      @kzmOP 4 ปีที่แล้ว

      hey congrats on your achievement! Could you pls share the approach (courses) on AI?

  • @3y3man
    @3y3man 5 ปีที่แล้ว +44

    It's like i just saw 1001 reasons not to use let and const and then you ended it saying "never use var"

    • @lyingcat9022
      @lyingcat9022 5 ปีที่แล้ว

      Ayman Bukar NON of those are reasons Not to use let and const. Quite the opposite really.

  • @GarmrZero13
    @GarmrZero13 5 ปีที่แล้ว

    Very good presentation! Its good to see you posting videos on your channel again

  • @noemonsivais2145
    @noemonsivais2145 4 ปีที่แล้ว

    I bought this course and didn't understand it much. I took a boot camp course through a university and I am using this as a review. No regrets in buying Colt's course because it is well explained, I just personally wasn't getting it. Now, many things are as clear as day.

  • @jasonwarner3490
    @jasonwarner3490 4 ปีที่แล้ว +1

    So many nuances, I think I will use var for everything unless I know I need to declare something that will not change (const) or if I only want something declaring inside of it's own block (let)

    • @DominicNweze
      @DominicNweze 2 ปีที่แล้ว

      like seriously. I don't even see a point in making other ways of declaring a variable.
      when other langues ain't doing that .😂

  • @babatundeololade6765
    @babatundeololade6765 5 ปีที่แล้ว

    It's good to see my instructor here on utube again.

  • @leahmattern9465
    @leahmattern9465 5 ปีที่แล้ว +1

    Oh my gosh, THANK YOU!! I'm still a bit new to JS, and the different ways to declare variables has been freaking me out! (Also, I dig this glasses!)

  • @dave_ynh
    @dave_ynh 5 ปีที่แล้ว +3

    Thanks!
    As usual, everything is very clear.

  • @jinwookkim8511
    @jinwookkim8511 5 ปีที่แล้ว +1

    the Best introductory lesson for let, const & var! 😃

  • @jessylin7867
    @jessylin7867 3 ปีที่แล้ว

    pretty clear video!! Thank you!!!

  • @davinder946
    @davinder946 5 ปีที่แล้ว

    Hi colt thanks for video. Waiting for your new course. You r one of my best instructor.

  • @misterfuzzykins
    @misterfuzzykins 5 ปีที่แล้ว

    Sweet! I've been binging on coding seminar talks, and a lot of them use these. Had a vague idea of what they meant before, but now I'm good to go! Thanks Colt

  • @lubhitmalhotra625
    @lubhitmalhotra625 4 ปีที่แล้ว

    YOU ARE GREAT SIR.
    THANK YOU AND I AM YOUR NEW STUDENT.

  • @Ploofles
    @Ploofles 4 ปีที่แล้ว

    thanks man, really helped out a lot

  • @excessreactant9045
    @excessreactant9045 3 ปีที่แล้ว

    Thanks colt
    Well taught

  • @stephenpino235
    @stephenpino235 4 ปีที่แล้ว

    Great focused explanation please keep up the good work

  • @n1111shant
    @n1111shant 4 ปีที่แล้ว

    colt itself is a brand!!!!!!!!!!!

  • @urosciric8030
    @urosciric8030 4 ปีที่แล้ว

    Thank you. I use let and const daily, but need to look at this video before every interview haha

  • @urosciric8030
    @urosciric8030 4 ปีที่แล้ว

    Thanks for the simple explanation

  • @tenminutetokyo2643
    @tenminutetokyo2643 4 ปีที่แล้ว +1

    Awesome, please do a complete course on JS. Just the basics.

  • @orieiran3487
    @orieiran3487 4 ปีที่แล้ว

    Thanks Colt. Your awesome!

  • @devbox9922
    @devbox9922 3 ปีที่แล้ว

    Watched a ton of video about var, but didn't know about window object, that's crazy, Why js, just why!

  • @himbary
    @himbary 5 ปีที่แล้ว

    Wow, yesterday I was searching for a video about them and now this. Thank u

  • @JatinderSingh-du1ny
    @JatinderSingh-du1ny 4 ปีที่แล้ว

    Thanks! I've seen your tutorials on udemy also. You're Gifted instructor. Keep it up. It helps many seeker

  • @michaelmedina7889
    @michaelmedina7889 5 ปีที่แล้ว

    Wow! Now I get it! Thanks Colt you're the best!

  • @ziel_ar
    @ziel_ar 5 ปีที่แล้ว

    Hi Colt! I would love to see more movies like this one.

    • @ColtSteeleCode
      @ColtSteeleCode  5 ปีที่แล้ว

      Let me know if you have any topics you'd like me to cover!

    • @ziel_ar
      @ziel_ar 5 ปีที่แล้ว

      How about differences between window, screen, and document in Javascript?
      I do not catch it fully. If you find this topic interesting enough for the next movie, it would be great, but I will accept any other content equally willingly!

  • @coolsweatz
    @coolsweatz 4 ปีที่แล้ว

    Really helpful video 👍🏾

  • @Rahul-jy9wg
    @Rahul-jy9wg 5 ปีที่แล้ว

    It's good to see you on TH-cam

  • @kerryd2060
    @kerryd2060 5 ปีที่แล้ว

    Great video. I signed up for all your Udemy courses & will start soon. I like that you don't include background music in your courses. I found some of the instructors on Udemy include background music and it is very distracting from the material.

  • @SethWilson
    @SethWilson 5 ปีที่แล้ว

    Thanks for this, was just thinking about this the other day.

  • @laszlopaszlavszki3569
    @laszlopaszlavszki3569 2 ปีที่แล้ว

    Nice and respectful comment

  • @JatinGera
    @JatinGera 5 ปีที่แล้ว +1

    Thanks man love your videos

  • @katheyjohn93
    @katheyjohn93 4 ปีที่แล้ว

    Hi....Why do you say at the end of the video that you prefer Const over let and var the least preferred? Thank you:)

  • @areskyberkane9295
    @areskyberkane9295 5 ปีที่แล้ว +1

    you are awesome!!
    From Spain! Thank you so much!!

  • @papaOhmTV
    @papaOhmTV 5 ปีที่แล้ว

    That's deep! Thanks Colt...

  • @IdrisMC
    @IdrisMC 5 ปีที่แล้ว

    Finally, dont forget to claim your TH-cam URL😋 and please answer questions on advanced webdeveloper bootcamp

  • @srushteesatardey9478
    @srushteesatardey9478 5 ปีที่แล้ว

    best explanation ever

  • @kondasomu
    @kondasomu 2 ปีที่แล้ว

    Hi sir,I have a doubt when using const keyword value will not change but when I use like this value is changing for 'const' keyword. code is: const x = { name: "scott"}; x.name = "john"; console.log(x); Result:john. Why const is printing john instead of scott. Can you please give me reason.

  • @kondasomu
    @kondasomu 2 ปีที่แล้ว

    hi sir,
    I have a doubt while using const keyword
    const x = {name: "scott"};
    x.name = "john";
    console.log(x);
    here 'x' value is john, actually it should be scott. why 'x' value is changing, please clear me

  • @siddhantjain2402
    @siddhantjain2402 5 ปีที่แล้ว

    Hi Colt! I took your Udemy course on Full Stack Development and it totally worth it!
    There is one question I want to ask that I need to choose between Node.js and Django.
    I am well versed in both Javascript and Python but it is a bit difficult to keep up with both of the frameworks. I want to choose between one and stick with it.
    Complexity is not an issue, I just want to choose the framework with more power and options. Please let me know what you think about it! :) Thanks!

    • @siddhantjain2402
      @siddhantjain2402 5 ปีที่แล้ว

      ​@@natnaelabrham200 I am sorry if my question was not clear. I want to focus on one Back-end (server-side) framework rather than two. You can say it is a comparison between Express and Django if you want.
      And yes, both are written in different languages but they both essentially provides a solution to the same problem. I am a bit lost as to which one is better for server-side scripting. Thanks! :)

    • @ColtSteeleCode
      @ColtSteeleCode  5 ปีที่แล้ว +4

      Hi Siddhant, that's a tough question to answer because it really depends on what you want to build and what your requirements are. I definitely recommend picking one and sticking with it while you are learning, but it doesn't mean you need to stick with that one forever. Most developers learn on a single framework and then branch out later and pick up a couple others. So think of it as picking one framework to start with, rather than picking THE ONE FRAMEWORK TO RULE ALL. Node itself isn't a framework, but there are many Node frameworks you could choose from: Express, Koa, Sails, etc. You really can't go wrong either way, but since you're asking...I would recommend going with python on the backend not because it's any better overall, simply because I think it's a better way of learning. I prefer to teach my in-person students two languages: JS for the frontend and something else on the backend (python usually), I prefer this approach because it really helps make the distinction between frontend and backend clear AND it's always good to know more than one language. I've found that students who learn JS and then go on to also use JS on the backend (node) often don't have a full understanding of how everything works together. In addition, python and django (or flask) have huge communities and lots of resources online. Node frameworks do too, but the community is more fragmented around a larger number of frameworks. This is turning into a really long response, but really...it doesn't matter much. I think it's easy to put too much thought and effort into deciding where to start. I would go with Django or Flask + JS on the frontend. You'll be able to pickup Express or any other node framework extremely quickly afterwards.

    • @siddhantjain2402
      @siddhantjain2402 5 ปีที่แล้ว +1

      @@ColtSteeleCode Thank you so much for the reply! I think I have a clear understanding of what I should do now. Thanks a lot Colt, you are the best! ❤️

  • @green939
    @green939 4 ปีที่แล้ว

    Thank you so much for such a nice video! I finally got it! :D

  • @ashome7622
    @ashome7622 5 ปีที่แล้ว +1

    Hey Colt your glass is a nice one 🤓

  • @phuongthuyothi203
    @phuongthuyothi203 5 ปีที่แล้ว

    Love this video

  • @brothercaleb
    @brothercaleb 5 ปีที่แล้ว +20

    0:12 sooo, those glasses.... wat brand are they? 😜

    • @ColtSteeleCode
      @ColtSteeleCode  5 ปีที่แล้ว +27

      :) They're made by a company called Jins. They were actually really affordable. $60 or $70.

    • @just-justice-here
      @just-justice-here 3 ปีที่แล้ว

      Funny how Colt's comment got more likes than the original comment

  • @agung_laksana
    @agung_laksana 5 ปีที่แล้ว +14

    Colt, nodejs course please

  • @somyasarathisamal
    @somyasarathisamal 4 ปีที่แล้ว +1

    As you said var is added to windows, What does it mean??

  • @error53ish
    @error53ish 5 ปีที่แล้ว +1

    So if let and const don't get added to the window object... where do they go, if they are globally scoped?

  • @ar3ol
    @ar3ol 4 ปีที่แล้ว +3

    great video, thanks! but i'm still not clear why stay away from var, var seems totally fine to me.

    • @RmonikMusic
      @RmonikMusic 4 ปีที่แล้ว +6

      Basically it's about safety. Using let and const further limits the scope (= in which space the variable exists) so you'll need to declare it in the exact scope you plan to use it in. This will make sure you won't have issues later on because you've forgotten about some variable you or someone else declared in the same scope and try to declare a variable with the same name, etc. In short, it enforces best practices.

    • @newChiller
      @newChiller 4 ปีที่แล้ว

      @@RmonikMusic Thanks for the explanation

  • @Etienne_O
    @Etienne_O 5 ปีที่แล้ว

    Thanks Colte!! If you could upload your videos in 4k it would be very nice.

  • @expansivegymnast1020
    @expansivegymnast1020 ปีที่แล้ว

    Noob question what IDE lets you see the console objects like that?

  • @DojoDyo
    @DojoDyo 4 หลายเดือนก่อน

    Love the glasses, I also have these glasses ! hehe

  • @FiftyKcal
    @FiftyKcal 5 ปีที่แล้ว +2

    Great video Colt! Would be great to see more videos of you explaining things like the "this" keyword or .bind, etc.

  • @kyawn5115
    @kyawn5115 4 ปีที่แล้ว

    Thank you!

  • @sebastianbasic252
    @sebastianbasic252 4 ปีที่แล้ว

    So basically, let is behaving like a normal variable in Java or c++?

  • @ecek123
    @ecek123 5 ปีที่แล้ว

    var seems more versatile, why shouldn't we use it? and why did they feel the need to create const and let? what is it that var cannot do that created the need for const and let?

  • @ryukai1343
    @ryukai1343 4 ปีที่แล้ว

    curious why does it matter if its added to the windows object or not?

  • @soccer19957
    @soccer19957 5 ปีที่แล้ว

    Awesome video!!!

  • @JibinPhiliposeDGameR
    @JibinPhiliposeDGameR 5 ปีที่แล้ว

    Which vscode theme are you using colt?

  • @independentvariablez7854
    @independentvariablez7854 4 ปีที่แล้ว

    Steph and Klay? Caught a Golden State fan.

    • @elatif7214
      @elatif7214 3 ปีที่แล้ว

      And Kevin lol

  • @lfb640
    @lfb640 5 ปีที่แล้ว +2

    Is this the same in Java? I know that are different languajes but ya know my point

    • @chickenzwings
      @chickenzwings 5 ปีที่แล้ว +5

      Nope! Java is called a "statically typed" language. That means when we declare variables in java, we need to be more specific than "let" or "const". ex: int a = 10; Rather than var a = 10;

    • @jahongirhusanov6878
      @jahongirhusanov6878 5 ปีที่แล้ว

      @@chickenzwings but it gives the same error when you try to redeclare previously declared and initialized variable.

  • @Obyvvatel
    @Obyvvatel 5 ปีที่แล้ว

    And in contrast I only use var, because it's guaranteed to work and I don't mind it being accessible 1 step further when just in if, or for blocks

  • @TheLittleLadyCook
    @TheLittleLadyCook 4 ปีที่แล้ว

    Here from the Bootcamp on Udemy ^^

  • @ganeshkumar269
    @ganeshkumar269 4 ปีที่แล้ว

    var : has an execution context scope, added to window obj.
    let: block scoped, isn't added to window obj.
    const : block scoped , isn't added to window obj, reference must not be changed once declared

  • @puneetsharma1437
    @puneetsharma1437 3 ปีที่แล้ว

    thank you

  • @error53ish
    @error53ish 5 ปีที่แล้ว

    Wait... what are people saying about your glasses? I think they are pretty cool.

  • @theangamba6601
    @theangamba6601 5 ปีที่แล้ว

    Really helpful

  • @johnnguyen1655
    @johnnguyen1655 4 ปีที่แล้ว

    Very nice explanation, Thanks!
    BTW as you mentioned at th-cam.com/video/dzEieWaOJE0/w-d-xo.html, does it means that when we write some js code using let variable, all android device cannot load the page as expected?

  • @icgaming1692
    @icgaming1692 4 ปีที่แล้ว

    you are a great guy i am learning from your course. can i work with u.

  • @IdrisMC
    @IdrisMC 5 ปีที่แล้ว

    What is the window object and the global object, for what is it used?

    • @erickvalencia7962
      @erickvalencia7962 5 ปีที่แล้ว

      Window is the global object. So It means that when you run JavaScript code(an script), the global object is automatically created with many things inside. And You can use it for accessing some properties and values and use it in your code.

  • @armanabdullah3208
    @armanabdullah3208 4 ปีที่แล้ว

    sir where do u reside now?

  • @lfb640
    @lfb640 5 ปีที่แล้ว

    Nice vídeo by the way

  • @naysolutions4225
    @naysolutions4225 4 ปีที่แล้ว

    I have found more detail on this topic here #letDeclarations

  • @petrospetrosyan1414
    @petrospetrosyan1414 5 ปีที่แล้ว +2

    What's the difference between using “let” and “var”?

  • @WaldoTheWombat
    @WaldoTheWombat 5 ปีที่แล้ว

    i don't understand why i shouldn't use var, i understand from your video that it doesn't have any restrictions....?

  • @iyleveeranna4134
    @iyleveeranna4134 5 ปีที่แล้ว

    Thanks Colte 🙂👍

  • @RealToughCandy
    @RealToughCandy 5 ปีที่แล้ว

    What's up Colt!

  • @RicardoAlex879
    @RicardoAlex879 4 ปีที่แล้ว

    Essentially - var - creates/declares new variable. let - allows variables to be reassigned and const - cannot be reassigned

  • @fvanessagan
    @fvanessagan 3 ปีที่แล้ว

    why do we need let and const? why don't we just use var with a different name?