Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update script.js #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
69 changes: 36 additions & 33 deletions 01_05/script.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,59 @@
/**
* Create a Backpack object, populate some HTML to display its properties.
* Create an investment 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 markup = (backpack) => {
const client = {
name: "",
address: "",
email: "",
phone: "";
};

const advisor = {
name: "Elisabeth Noble",
city: "Jacksonville",
email: "[email protected]";
};

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

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>
`;
};

const main = document.createElement("main");
main.innerHTML = markup(backpack);
document.body.appendChild(main);