- Using an object literal, create a variable named rabbit that holds a reference to an Object that has a property named name which is set to the String Peter and a property named height which is set to 42.
- Write a statement that sets the name field of the variable rabbit to “Roger“.
- Write a statement using dot notation that prints the height of the rabbit.
- Write a statement using [] notation that prints the height of the rabbit.
- Create an array named items that holds the following values: 22, “hello”, and {a: 10}.
- Declare an array named grades and initialize it with the values 85, 93, 79, 98, 100.
- Use the from method on the array named grades to create a new array named curvedGrades so that each grade in curvedGrades is 5 more than the respective value in grades.
- Using a single statement, create an array named holy that has two elements, one at index 1 with a value 10 and one at index 3 with a value 20.
- What are the values of the elements at index 0 and 2 in the array named holy?
- Suppose a variable named cow is initialized to the value 7. Is the following statement a legal expression? holy[cow] = 3;
- What method can use use to determine if a variable holds a reference to an Array?
- Suppose an array named names has been declared and initialized with a set of student names. Write a statement that declares a variable named indices that holds an array of the valid indices for the array named names.
- Write a statement that declares a variable named pairs that holds key/value pairs for each index/name pair in names.
- Write a statement that declare an array named bigArray that holds 100 integers.
- Write a statement that prints to the console the contents of the array named names with ” hush now ” separating the names.
- List the element on a stack starting at the top, after the following operations have been executed? push(1), push(2), pop(), push(3)
- List the elements on a queue starting at the top, after the following operations have been executed? push(1), push(2), shift(), push(3)
- Suppose an array named ages holds a set of integers. Write a statement using the sort method that sorts the value from largest to smallest.
© 2020, Eric. All rights reserved.