What is Scope in JavaScript?

Поделиться
HTML-код
  • Опубликовано: 13 июл 2024
  • In today's video I'll be explaining the 3 different types of scopes in JavaScript: global scope, function scope and block scope. If you're new to JavaScript or don't understand scopes, it's super important to make sure you're across this concept.
    Chapters:
    0:00 Intro
    0:44 Global Scope
    3:46 Function Scope
    5:47 Block Scope
    9:07 Outro
    For your reference, check this out:
    developer.mozilla.org/en-US/d...
    🏫 My Udemy Courses - www.udemy.com/user/domenic-co...
    🎨 Download my VS Code theme - marketplace.visualstudio.com/...
    💜 Join my Discord Server - / discord
    🐦 Find me on Twitter - / dcodeyt
    💸 Support me on Patreon - / dcode
    📰 Follow me on DEV Community - dev.to/dcodeyt
    📹 Join this channel to get access to perks - / @dcode-software
    If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
    #dcode #javascript

Комментарии • 19

  • @kevinvz5387
    @kevinvz5387 2 года назад +6

    Never realized var escaped block scopes, awesome video as always

  • @ryantoh6725
    @ryantoh6725 2 года назад

    Another good one Dom thanks!!

  • @ghaziali3504
    @ghaziali3504 2 года назад

    Perfectly Explained !!

  • @bahramiwd4812
    @bahramiwd4812 2 года назад

    Your video really helped me because I was confused with scopes. Thanks

  • @agentprotik2069
    @agentprotik2069 2 года назад

    you have earned my subscription. keep goin mate

  • @lautarofigueroa
    @lautarofigueroa 2 года назад

    Very useful! new sub

  • @karimfawzy8932
    @karimfawzy8932 Год назад

    Now i could understand that tricks that had me confused since 2 year , thank u sir lam really happy to get this wonderful channel ❤

  • @CiscoZero
    @CiscoZero 2 года назад

    Amazing lesson! I'm so far ahead learning syntax and methods, but I had no idea about scopes. Why hadn't I learned this very basic concept in coding?

  • @thiagomeneses6373
    @thiagomeneses6373 2 года назад

    Thank you for your video! However I still have some questions, in the start of the video you mentioned that variables assigned with let and const can still be global variables, however they cannot be found in the window object, but when trying this out in my computer this did not happen, even variables defined with these keywords were shown in my object. Also, I was able to use them like this: window.varName. Both when using let and also const

  • @emmanuelsaraiva1908
    @emmanuelsaraiva1908 2 года назад

    Amazing, man! As a beginner, you've made things clearer for me to understand the concepts... Thank you!

  • @TomDoesTech
    @TomDoesTech 2 года назад

    Nice to hear a fellow Aussie making JS videos :)

  • @ghaziali3504
    @ghaziali3504 2 года назад

    Bro what's your vs code color theme I like the colors of your code.

  • @thefsquad7787
    @thefsquad7787 2 года назад +1

    But why just not always use var ? so you can access it from everywhere?

    • @mhdfr
      @mhdfr 2 года назад +1

      Sometime can be chaotic

    • @pcheng
      @pcheng 2 года назад

      var is also having hoisting issue, makes bad readability and understanding

    • @ghaziali3504
      @ghaziali3504 2 года назад

      Using too much var for a global scope also makes the browser load slow it takes up more memory.

  • @soulful-intellect
    @soulful-intellect 2 года назад

    could not explain