scrimba
Create an RPG game - Rob Sutcliffe
Constructor Functions
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Constructor Functions
by
AboutCommentsNotes
Constructor Functions
by
Expand for more info
index.js
run
preview
console
// Add all of the bookData attributes to the 
// new object been created in the Book constructor


const book = {
id:1,
emoji: "📗",
author: "George Orwell",
title:"1984",
format:"Paperback",
price:"$9.99",
}


document.getElementById("books").innerHTML = `
<div class="book">
<div class="emoji">${book.emoji}</div>
<div class="title">${book.title}</div>
<div class="author">${book.author}</div>
<div class="format">${book.format}</div>
<div class="price">${book.price}</div>
<button id="cart-${book.id}">Add to Cart</button>
</div>`;
Console
/index.html
-3:27