Chapter 3 Part II Review

  1. Are Strings mutable or immutable?
  2. What function can convert any value to a String?
  3. If you know a value is not null or undefined, what other method can you use to convert the value to a String?
  4. What characters surround a template literal?
  5. Define a single String that spans 2 lines and has “Hello” on the first line and “World!” on the second line.
  6. What is the syntax for an interpolated variable in a template literal?
  7. Suppose a variable named age has been declared and initialized with the value 10. Create a string using a template literal and interpolation that hold “Age: 10”.
  8. List 4 unary operators.
  9. What does unary plus do to a non-numeric variable?
  10. What does unary minus do to a non-numeric variable?
  11. What are the logical NOT, logical AND, and logical OR operators?
  12. What does it mean for an operator to be short-circuited?
  13. What are the 3 multiplicative operators?
  14. Show how you can print the square root of 25 to the console using the exponentiation operator.
  15. What are the 4 relational operators?
  16. How are strings compared?
  17. What is the value of (“Brick” < “alphabet”)?
  18. What is the difference between == and ===?
  19. Suppose num1 and num2 have been declared and initialized. Using the conditional operator, set a variable named min equal to num1 if num1 is smaller than num2, otherwise set min equal to num2.
  20. Using a while-loop, print the values in the interval [1,100] to the console.
  21. Using a for-loop, print the values in the interval [1,100] to the console.
  22. What does a for-in loop iterate over?
  23. what does a for-of loop iterator over?
  24. Declare a function named foo that takes a string str and a number k as arguments and prints str to the console k times.
  25. Write a statement that calls foo.

© 2020, Eric. All rights reserved.