Super Quiz

  1. Declare a variable named arr that holds an array of 3 objects. Each object should holds information about a book and should contain a property named title that holds a string and a property named date_published that holds a number. Feel free to make up the data for the 3 objects.
  2. Write a function named printArray that takes an array as an argument and prints to the console the objects in the array, including each of the object’s properties and values. You may not simply pass the array to console.log.
  3. Write a function named insert that takes an array, a string, and an integer as arguments. The function should create a new object with title and date_published properties and set the property values using the string and integer that are passed into the function. The function should then add the new object to the array that was passed into the function.
  4. Add a new object using the insert function to the array that you created for problem 1. Call the printArray function to verify the new object is in the array.

© 2020, Eric. All rights reserved.