File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed
Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ Given the following code:
2+
3+ ```
4+ var x = variable[y];
5+ ```
6+
7+ What is ` y ` :
8+
9+ 1 . Index
10+ 2 . Key
11+ 3 . Index of key
12+ 4 . Array
13+
14+
15+
16+ ``` var s = "Hello";
17+ var x = s.toLowerCase();
18+ var l = s.length;
19+ ```
20+
21+ Indicate the type of each:
22+
23+ 1 . ` s `
24+ 2 . ` x `
25+ 3 . ` s.toLowerCase() `
26+ 4 . ` s.toLowerCase `
27+ 5 . ` s.length `
28+ 6 . ` l `
29+
30+ Indicate whether this is an expression or a statement:
31+
32+ 1 . ` l `
33+ 2 . ` l = 4; `
34+ 3 . ` l == 4 `
35+ 4 . ` if (l == 4) { console.log("yes"); } `
36+ 5 . ` console.log("yes"); `
37+ 6 . ` "yes" `
38+ 7 . `console.log(l == 4 ? "yes" : "no")
39+
40+ How can you tell whether something is a statement?
41+ How can you tell whether something is an expression
42+
43+ Bonus:
44+ List all * statements* in the code above
45+ List all * expressions* in the code above
46+
47+
48+ Write code for the following:
49+
50+ 1 . Declare a variable called ` x ` and initialize it with the string "Hello".
51+ 2 . Declare a variable called ` y ` and initialize it with the property ` length ` of ` x ` .
52+ 3 . Declare a variable called ` z ` and initialize it with the result of calling the method ` toUpperCase ` on ` x `
You can’t perform that action at this time.
0 commit comments