What is the output of this code? var _run=0 ; function _runchange(){ var _run=1;} console.log(_run); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the output of this code? var _run=0 ; function _runchange(){ var _run=1;} console.log(_run);

3rd Sep 2019, 10:46 PM
Kensy Master Will
Kensy Master Will - avatar
7 Answers
+ 3
good luck
3rd Sep 2019, 11:52 PM
ABADA S
ABADA S - avatar
+ 2
it is 0 because you declared a new variable called _run with the same name with the global variable so it will not affect on the global even if you call _runchange function to access global variable use window object example: window._run=5; this makes the global _run equals to 5
3rd Sep 2019, 11:17 PM
ABADA S
ABADA S - avatar
+ 2
which one?
3rd Sep 2019, 11:40 PM
ABADA S
ABADA S - avatar
+ 2
I'm coding a browser app(interractive) . Where i will learn javascript from its first released version in 20th century to the last version . I will note features from each version. In this project my programming skills is being greather.
3rd Sep 2019, 11:45 PM
Kensy Master Will
Kensy Master Will - avatar
+ 2
Thanks
3rd Sep 2019, 11:53 PM
Kensy Master Will
Kensy Master Will - avatar
+ 1
I made this mistake on my project
3rd Sep 2019, 11:20 PM
Kensy Master Will
Kensy Master Will - avatar
+ 1
It's my current project
3rd Sep 2019, 11:41 PM
Kensy Master Will
Kensy Master Will - avatar