#16 JavaScript Variable Scope | JavaScript for Beginners

preview_player
Показать описание
Scope refers to the availability of variables and functions in certain parts of the code. In JavaScript, a variable has two types of scope: Global Scope and Local Scope

In computer programming, variable scope defines the availability of a variable in different regions of a program. Watch the full video to have a clear understanding of the working of JavaScript variables scope.

~

Timestamps:
00:14 Scope
03:15 Global Scope
04:19 Change the value of Global Variable
06:24 Block Scoped
08:18 Quiz

Find Programiz elsewhere:
---------------------------------------------------

#16 JavaScript Variable Scope | JavaScript for Beginners

#programiz #javascript #JStutorial #global #local #scope #variablescope #learnprogramming
Рекомендации по теме
Комментарии
Автор

🚀Loved the JS tutorial? Take it further with Programiz PRO!
Refine your skills and build confidence with interactive lessons, quizzes, and challenges. Strengthen your programming foundation and master JavaScript today!

programizstudios
Автор

I have seen all of your videos in js, and i would like to say thank you for sharing this type of incredible knowledge!!!❤❤❤❤

tikuretentrance
Автор

I believe the answer for the end question would be answer #3, 20.
- globally 'a' = 88
- then our function redefines 'a' to = 77
- then our function takes the newly defined value of 'a' and subtracts 57 to get a new value of 'a' as 20
- Outside of the function in the "global zone" we call upon/invoke our function that then globally defines 'a' as 20

Great tutorials again, so easily explained. Love this series and your channel <3

jacksebbenunicyclist
Автор

answer 88
bcz 1st let a =88
second let in function that is block scope

1st function call noting happend ..
then console.log (a) call that mean the cansole.log(a) refer to 1st let a =88 bcz sencod let in fuction that is block scope

halee
Автор

at the block scope when you tried to print with the console result1 gave a ReferenceError which is pretty understandable because you wrote console.log(result1); but there is a way to console log the result1 outside of the block, like console.log(result.result1) or something? The answer to your question at the end is 3. 20?

IstvanWeisz_logoby
Автор

88.

because when you declare variable inside function it becomes blocked. but if you didn't wrote let it will be globel

mohammedgawish
Автор

a is 20. the function name has been called already, hence a will be 77 - 57.

AdeoluwaIdowu
Автор

Hey Punit, going through the Javascript tutorial but whenever I am try to run a code to get user input using parseInt, or parseFloat (prompt("")) for example, I always get an error. No matter where I try to so it. Your online compiler, vscode, like anywhere

Below is the Error. Can you please help. Thank you

node /tmp/birPAQMq81.js

throw err;
^

Error: Cannot find module 'readline-sync'
at
at Function.Module._load
at Module.require
at require
at Object.<anonymous> (/tmp/birPAQMq81.js:8:26)
at Module._compile
at Object.Module._extensions..js
at Module.load
at tryModuleLoad
at Function.Module._load

Project-Salone-Man
join shbcf.ru