From the course: JavaScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Create a new object type

Solution: Create a new object type - JavaScript Tutorial

From the course: JavaScript Essential Training

Solution: Create a new object type

(upbeat music) - [Instructor] To solve this challenge, we need to create a new object constructor and if we look down in the test code, we already have an indication of what this object constructor's going to look like because we're calling in a new book from the book object constructor and then we're calling in these four properties. So to start off, I'm going to start here and say create a new function, then call it book with a capitalized B to say this is an object constructor and then set up my parameters here and they will be title, for the book title, see down here, book title, then comma, author, comma ISBN and finally, publication year. Now you'll notice that names used down here do not match the ones up here, that's because we're working inside the object constructor now and I can give it whatever names I want. So I want to be very clear about what these things are. So, title, author, ISBN and publication…

Contents