Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 34 additions & 40 deletions 01_05/script.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,46 @@
/**
* Create a Backpack object, populate some HTML to display its properties.
*/

// Single line comment

/* Multi-line comment
See! this line is also commented out! */

const updateBackpack = (update) => {
const updateInvestments = (update) => {
let main = document.querySelector("main"); // main is an element
main.innerHTML = markup(backpack);
main.innerHTML = markup(investments);
console.info(update);
};

const backpack = {
name: "Everyday Backpack",
volume: 30,
color: "grey",
pocketNum: 15,
strapLength: {
left: 26,
right: 26,
},
lidOpen: false,
toggleLid: function (lidStatus) {
this.lidOpen = lidStatus;
updateBackpack(`Lid status changed.`);
},
newStrapLength: function (lengthLeft, lengthRight) {
this.strapLength.left = lengthLeft;
this.strapLength.right = lengthRight;
updateBackpack(`Strap lengths updated.`);
},
const investments = {
name: "Apple",
risklevel: "Moderate",
price: 32,
ticker: 'AAPL',
type: 'ETF';
};

const client = {
name: "",
address: "",
email: "",
phone: "";
};

const advisor = {
name: "Elisabeth Noble",
phone: "904-352-6609",
email: "elisabeth@healthylivinginvestments.com";
};

const ETFholdings = {
stock1: "",
stock2: "",
bond1: "",
bond2: "";
};

const markup = (backpack) => {
const markup = (investments) => {
return `
<div>
<h3>${backpack.name}</h3>
<h3>${investments.name}</h3>
<ul>
<li>Volume: ${backpack.volume}</li>
<li>Color: ${backpack.color}</li>
<li>Number of pockets: ${backpack.pocketNum}</li>
<li>Strap lengths: L: ${backpack.strapLength.left}, R: ${
backpack.strapLength.right
} </li>
<li>Top lid: ${backpack.lidOpen ? "Open" : "Closed"}</li>
</ul>
<li>Ticker: ${investments.ticker}</li>
<li>Risk: ${investments.risk}</li>
<li>Price: ${investments.price}</li>
<li>Type: ${investments.type}</li>
</div>
`;
};
Expand Down