Skip to content

Commit

Permalink
Fixed some bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Zhong <69879040+Brunozhon@users.noreply.github.com>
  • Loading branch information
Brunozhon committed Aug 23, 2023
1 parent 90eb39a commit 714ce99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ <h1>The Bruno Store</h1>
let html = ""
for (const book in items) {
html += `<h2>${book}</h2>
<p>${bookData[book][0]}</p>
<p>Cost: $${bookData[book][1]}.`
<p>${items[book][0]}</p>
<p>Cost: $${items[book][1]}.`
// Format cents. This is why I seperated the dollars and cents to two values.
var cost = bookData[book][2]
var cost = items[book][2]
if (cost < 10 && cost > -1) {
cost = cost.toString()
cost = "0" + cost
}
html += `${cost}</p><p><a href="${bookData[book][3]}">Buy now!</a></p>`
html += `${cost}</p><p><a href="${items[book][3]}">Buy now!</a></p>`
}
document.getElementById("bookcontainer").innerHTML = html
</script>
Expand Down

0 comments on commit 714ce99

Please sign in to comment.