Garmaine Staff asked 2 years ago

I'm trying to create a form that when submitted, creates a new object with the input values, and then stores that object in an array.

For some reason, the array is "resetting" and not saving the objects.

let myLibrary = []

function Book(title,author,pages,read) {
	this.title = title = author
	this.pages = pages = read

function checkForm(){
	let name = document.querySelector('input[name="title"]').value
	let author = document.querySelector('input[name="author"]').value
	let pages = document.querySelector('input[name="pages"]').value
	let read = document.querySelector('input[name="read"]').checked
  new Book(name,author,pages,read)