Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions 03_13/Backpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Backpack {
let acquired = new Date(this.dateAcquired);
let elapsed = now - acquired; // elapsed time in milliseconds
let daysSinceAcquired = Math.floor(elapsed / (1000 * 3600 * 24));
// Math floor zorgt ervoor dat de datum in milliseconds wordt gezet zonder decimalen.
// Dan deel je de nummer (elapsed) door de seconden/uren/uren in een dag en dan heb je de daggen
return daysSinceAcquired;
}
}
Expand Down
1 change: 1 addition & 0 deletions 03_13/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ const everydayPack = new Backpack(

console.log("The everydayPack object:", everydayPack);
console.log("Date acquired:", everydayPack.dateAcquired);
console.log("Date since acquerd:", everydayPack.backpackAge());
17 changes: 1 addition & 16 deletions 04_01/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,5 @@
<script type="module" src="Backpack.js"></script>
<script type="module" src="script.js"></script>
</head>
<body>
<main>
<article>
<h1>Everyday Backpack</h1>
<ul>
<li>Volume:</li>
<li>Color:</li>
<li>Age:</li>
<li>Number of pockets:</li>
<li>Left strap length:</li>
<li>Right strap length:</li>
<li>Lid status:</li>
</ul>
</article>
</main>
</body>
<body></body>
</html>
19 changes: 19 additions & 0 deletions 04_01/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ const everydayPack = new Backpack(
"December 5, 2018 15:00:00 PST"
);

const input = `
<main>
<article>
<h1>${everydayPack.name}</h1>
<ul>
<li>Volume: ${everydayPack.volume}</li>
<li>Color: ${everydayPack.color}</li>
<li>Age: ${everydayPack.backpackAge()}</li>
<li>Number of pockets: ${everydayPack.pocketNum}</li>
<li>Left strap length: ${everydayPack.strapLength.left}</li>
<li>Right strap length: ${everydayPack.strapLength.right}</li>
<li>Lid status: ${everydayPack.lidOpen}</li>
</ul>
</article>
</main>
`;

document.body.innerHTML = input;

console.log("The everydayPack object:", everydayPack);
console.log("The pocketNum value:", everydayPack.pocketNum);
console.log("Days since aquired:", everydayPack.backpackAge());
2 changes: 2 additions & 0 deletions 05_06/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import Backpack from "./Backpack.js";

const image2 = "../assets/images/frog.svg";

const everydayPack = new Backpack(
"Everyday Backpack",
30,
Expand Down
18 changes: 9 additions & 9 deletions 08_03/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ const greenPack = {
pocketNum: 3,
};

const addPack = function (currentPack) {
const newArticle = document.createElement("article");
newArticle.innerHTML = `
<h1>${currentPack.name}</h1>
const addBackPack = function (backPack) {
const article = document.createElement("article");
article.innerHTML = `
<h1>${backPack.name}</h1>
<ul>
<li>Volume: ${currentPack.volume}</li>
<li>Color: ${currentPack.color}</li>
<li>Number of pockets: ${currentPack.pocketNum}</li>
<li>Volume: ${backPack.volume}</li>
<li>Color: ${backPack.color}</li>
<li>Number of pockets: ${backPack.pocketNum}</li>
</ul>
`;
return newArticle;
return article;
};

const main = document.querySelector("main");
main.append(addPack(greenPack));
main.appendChild(addBackPack(greenPack));
26 changes: 26 additions & 0 deletions Practice/03_07/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,29 @@
* - Find an object that has another object inside of it to create a nested object.
* - Test your objects in the browser console by accessing the entire object and its specific properties.
*/

const persoon = {
voornaam: "Adam",
achternaam: "Saber",
lengthe: "180cm",
};
console.log("Dit is de persoon object:", persoon);

const kast = {
lengthe: "1 meter",
breedte: "70 centimeter",
hooghte: "80 centimeter",
doos: {
schoenen: "Nike Air Max",
jas: "North Face",
},
jassen: 50,
licht: () => {
return "Dit is een functie";
},
};
console.log("Dit is de kast object:", kast);
console.log("De kast lengthe is:", kast.lengthe);
console.log("Dit is de nested object:", kast.doos);
console.log("Dit zijn de schoenen in de doos:", kast.doos.schoenen);
console.log(kast.licht());
18 changes: 18 additions & 0 deletions Practice/03_09/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

const backpack = {
name: "Everyday Backpack",
realName: function (echteNaam) {
this.name = echteNaam;
},
volume: 30,
realVolume: function (echteVolume) {
this.volume = echteVolume;
},
color: "grey",
pocketNum: 15,
strapLength: {
Expand All @@ -24,3 +30,15 @@ const backpack = {
this.strapLength.right = lengthRight;
},
};

console.log("Naam functie:");
console.log(backpack.name);
backpack.realName("Adam");
console.log(backpack.name);

console.log("");

console.log("Volume functie:");
console.log(backpack.volume);
backpack.realVolume(100);
console.log(backpack.volume);
34 changes: 32 additions & 2 deletions Practice/03_12/Backpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Class expression: const Name = class {}
*/

class Backpack {
export class Backpack {
constructor(
// Defines parameters:
name,
Expand Down Expand Up @@ -37,4 +37,34 @@ class Backpack {
}
}

export default Backpack;
export class Kast {
constructor(
//Parameters
lengthe,
breedte,
kleur,
aspact,
blueberry,
model,
kastOpen
) {
// Properties
this.lengthe = lengthe;
this.breedte = breedte;
this.kleur = kleur;
this.kledingStukken = {
kledingAspact: aspact,
kledingBlue: blueberry,
};
this.model = model;
this.kastOpen = kastOpen;
}
// Functies toevoegen
toggelKast(kastStatus) {
this.kastOpen = kastStatus;
}
newKledingAantal(aspact, blueberry) {
this.kledingStukken.kledingAspact = aspact;
this.kledingStukken.kledingBlue = blueberry;
}
}
18 changes: 18 additions & 0 deletions Practice/03_12/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,21 @@
* - Create several objects using the class.
* - Test the objecs by calling their properties and using their methods in the console.
*/

import { Backpack, Kast } from "./Backpack.js";

const everydayKast = new Kast(
"120cm",
"80cm",
"Black",
12,
6,
"Nachtkast",
false
);

everydayKast.toggelKast(true);
console.log("De Everydaykast:", everydayKast);

everydayKast.newKledingAantal(15, 8);
console.log("De Everydaykast:", everydayKast);
16 changes: 16 additions & 0 deletions Practice/05_04/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,19 @@
* Note: This file is intentionally empty.
* You can use it to test your skills at traversing the DOM using JavaScript.
*/

console.log(document.querySelector(".backpack"));
console.log(document.querySelector(".backpack__image"));
console.log(document.querySelector(".backpack h1"));

console.log("Tussen regel");

console.log(document.querySelector("#pack02"));
console.log(document.querySelectorAll("#pack01 .backpack__features li"));
console.log(document.querySelectorAll("#pack02 .backpack__features li"));

console.log("Tussen regel");

console.log(document.querySelector("#pack02 .backpack__image"));
console.log(document.querySelector("#pack01 .lid-toggle"));
console.log(document.querySelectorAll(".backpack__image"));
2 changes: 2 additions & 0 deletions Practice/05_08/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
* You can use it to test your skills at adding, removing, or modifying
* attributes, classes, and inline styles on elements.
*/

document.querySelector("#pack01 img");
Loading