Global Scope - Demonstration

1 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.80
List Price:  €120.12
You save:  €34.32
£74.56
List Price:  £104.38
You save:  £29.82
CA$140.31
List Price:  CA$196.44
You save:  CA$56.13
A$154.06
List Price:  A$215.69
You save:  A$61.63
S$129.45
List Price:  S$181.24
You save:  S$51.78
HK$776.90
List Price:  HK$1,087.69
You save:  HK$310.79
CHF 79.27
List Price:  CHF 110.98
You save:  CHF 31.71
NOK kr1,006.37
List Price:  NOK kr1,408.96
You save:  NOK kr402.59
DKK kr640.81
List Price:  DKK kr897.16
You save:  DKK kr256.35
NZ$174.55
List Price:  NZ$244.38
You save:  NZ$69.82
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,203.32
List Price:  ৳17,085.13
You save:  ৳4,881.81
₹8,789.78
List Price:  ₹12,306.05
You save:  ₹3,516.26
RM422.55
List Price:  RM591.59
You save:  RM169.04
₦147,011.29
List Price:  ₦205,821.69
You save:  ₦58,810.40
₨28,363.60
List Price:  ₨39,710.18
You save:  ₨11,346.57
฿3,272.37
List Price:  ฿4,581.45
You save:  ฿1,309.08
₺4,195.44
List Price:  ₺5,873.79
You save:  ₺1,678.34
B$540.49
List Price:  B$756.71
You save:  B$216.22
R1,733.56
List Price:  R2,427.06
You save:  R693.49
Лв167.68
List Price:  Лв234.76
You save:  Лв67.08
₩142,214.45
List Price:  ₩199,105.92
You save:  ₩56,891.47
₪331.26
List Price:  ₪463.78
You save:  ₪132.52
₱5,813.56
List Price:  ₱8,139.22
You save:  ₱2,325.66
¥15,069.93
List Price:  ¥21,098.50
You save:  ¥6,028.57
MX$1,839.55
List Price:  MX$2,575.44
You save:  MX$735.89
QR365.20
List Price:  QR511.30
You save:  QR146.09
P1,342.63
List Price:  P1,879.74
You save:  P537.10
KSh12,940.70
List Price:  KSh18,117.50
You save:  KSh5,176.80
E£4,749.67
List Price:  E£6,649.73
You save:  E£1,900.06
ብር14,891.88
List Price:  ብር20,849.23
You save:  ብር5,957.35
Kz91,188.68
List Price:  Kz127,667.80
You save:  Kz36,479.12
CLP$95,922.40
List Price:  CLP$134,295.20
You save:  CLP$38,372.80
CN¥712.16
List Price:  CN¥997.06
You save:  CN¥284.89
RD$6,336.53
List Price:  RD$8,871.39
You save:  RD$2,534.86
DA13,011.19
List Price:  DA18,216.19
You save:  DA5,204.99
FJ$229.76
List Price:  FJ$321.68
You save:  FJ$91.91
Q767.43
List Price:  Q1,074.44
You save:  Q307
GY$20,958.45
List Price:  GY$29,342.67
You save:  GY$8,384.21
ISK kr12,149.78
List Price:  ISK kr17,010.18
You save:  ISK kr4,860.40
DH916.22
List Price:  DH1,282.74
You save:  DH366.52
L1,696.76
List Price:  L2,375.54
You save:  L678.77
ден5,286.49
List Price:  ден7,401.30
You save:  ден2,114.80
MOP$801.55
List Price:  MOP$1,122.20
You save:  MOP$320.65
N$1,747.17
List Price:  N$2,446.11
You save:  N$698.93
C$3,687.22
List Price:  C$5,162.26
You save:  C$1,475.03
रु14,110.78
List Price:  रु19,755.66
You save:  रु5,644.87
S/339.25
List Price:  S/474.97
You save:  S/135.71
K427.34
List Price:  K598.30
You save:  K170.95
SAR375.03
List Price:  SAR525.05
You save:  SAR150.02
ZK2,271.89
List Price:  ZK3,180.73
You save:  ZK908.84
L436.63
List Price:  L611.30
You save:  L174.67
Kč2,084.54
List Price:  Kč2,918.45
You save:  Kč833.90
Ft33,428.72
List Price:  Ft46,801.54
You save:  Ft13,372.82
SEK kr942.97
List Price:  SEK kr1,320.20
You save:  SEK kr377.22
ARS$145,710.44
List Price:  ARS$204,000.45
You save:  ARS$58,290
Bs692.35
List Price:  Bs969.32
You save:  Bs276.97
COP$385,655.42
List Price:  COP$539,933.01
You save:  COP$154,277.59
₡50,294.55
List Price:  ₡70,414.39
You save:  ₡20,119.83
L2,631.45
List Price:  L3,684.13
You save:  L1,052.68
₲711,136.51
List Price:  ₲995,619.56
You save:  ₲284,483.05
$U3,996.23
List Price:  $U5,594.89
You save:  $U1,598.65
zł364.19
List Price:  zł509.88
You save:  zł145.69
Already have an account? Log In

Transcript

Opened the examples folder and then open the global scope sub folder. Now let's look at the exe example global scope one. Here I have a global variable called speed, I know that's global because it's not in a function is defined outside of a function. So I declare the the variable speed, which is equal to 25. And then I have a console log statement outputting, that variable, and we should get 25 in the console. So if I click show examples, and then global scope, example one, we can see we get global speed 25 not a big surprise.

So let's look at global scope number two. So once again, I have the global variable speed, which is equal 25. But then I have this function inside of the function. I also output in the console speed from foo, which is the global speed variable defined on line three. And then on line nine, I have the console log statement to output, the value the global variable and online 10 execute foo, which also outputs that global variable. So let's take Look at show examples global scope two.

And I see the two messages speed from global scope 25 speed one through 25. Pretty simple stuff. But the point here is that a global variable is one is defined in the global scope. And we know we're in in global scope if we're not in a function, because variable speed is not defined in a function, which means it's global, even though we access it in a function on line six. This speed variable right here is still referencing the global speed. And then we're outputting it here.

So just remember that a global variable is one that is defined outside of a function

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.