- How is a particular date and time actually stored in a Date object?
- Declare a variable named now that holds a reference to a Date object representing the current date and time.
- Declare a variable named final that holds a reference to a Date object representing 1:30pm on April 24, 2020.
- What are the three primitive wrapper types?
- Primitive variables do not have methods, yet we can invoke methods on primitive variables. What is the JavaScript engine doing in order to accomplish this?
- Suppose a variable named mean has the value 76.3245. Provide a statement that prints to the console the value in mean with only 1 digit after the decimal point.
- Suppose a variable named name has the value “Joe Block”. Provide a statement that prints to the console the number of characters in name.
- Provide a statement that prints to the console the last character of the String in the variable named str.
- What are the three methods used to create substrings from strings?
- Suppose a string named course has the value “CSCI-240”. Write a statement that uses one of the substring methods to stores in a variable named num the numeric part of the course (“240”).
- Write a statement that uses a string method to store in a variable named loc the index of the first instance of “S” in the string course.
- What type of value is returned from startsWith(), endsWith(), and includes()?
- What do trim(), trimLeft(), and trimRight() do?
- Write a fragment of code that uses a string iterator and a while loop to print to the console the characters in the string “hello”, one on each line.
- Write a single statement that uses the destructuring operator to print to the console the characters in the string “hello”, one on each line.
- What variable holds a reference to the Global object?
- Write a fragment of code that returns a random number between 1 and 20.
© 2020, Eric. All rights reserved.