JavaScript/fundamentals at 1700b39bcb7986bcf23b1b9cc45ea74913c3579a · M3kH/JavaScript · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

Given the following code:

var x = variable[y];

What is y:

  1. Index
  2. Key
  3. Index of key
  4. Array
var x = s.toLowerCase();
var l = s.length;

Indicate the type of each:

  1. s
  2. x
  3. s.toLowerCase()
  4. s.toLowerCase
  5. s.length
  6. l

Indicate whether this is an expression or a statement:

  1. l
  2. l = 4;
  3. l == 4
  4. if (l == 4) { console.log("yes"); }
  5. console.log("yes");
  6. "yes"
  7. `console.log(l == 4 ? "yes" : "no")

How can you tell whether something is a statement? How can you tell whether something is an expression

Bonus: List all statements in the code above List all expressions in the code above

Write code for the following:

  1. Declare a variable called x and initialize it with the string "Hello".
  2. Declare a variable called y and initialize it with the property length of x.
  3. Declare a variable called z and initialize it with the result of calling the method toUpperCase on x