+
+
+ Super Title
+
+
+
+
+
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex1.js b/javascript2/week1/inclass/ex1.js
new file mode 100644
index 00000000..f79a7606
--- /dev/null
+++ b/javascript2/week1/inclass/ex1.js
@@ -0,0 +1,16 @@
+const dishes = ["Pizza", "Falafel", "Dal"]
+
+// add UL tag
+const ulTag = document.createElement("ul")
+
+// add many LI tags
+for(dish of dishes) {
+ const liTag = document.createElement("li")
+ // add data to element
+ liTag.innerText = dish
+ // Workspace manipulation
+ ulTag.appendChild(liTag)
+}
+
+// DOM manipulation
+document.body.appendChild(ulTag)
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex2.html b/javascript2/week1/inclass/ex2.html
new file mode 100644
index 00000000..552c3bab
--- /dev/null
+++ b/javascript2/week1/inclass/ex2.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Super Title
+
+
+
+
+
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex2.js b/javascript2/week1/inclass/ex2.js
new file mode 100644
index 00000000..0a37de29
--- /dev/null
+++ b/javascript2/week1/inclass/ex2.js
@@ -0,0 +1,45 @@
+const podcasts = [{
+ name: 'The mystery om of Johan Klausen Varbourg',
+ imageUrl: 'https://picsum.photos/536/354'
+},
+{
+ name: 'Tips about dogs with small legs',
+ imageUrl: 'https://picsum.photos/536/354'
+},
+{
+ name: 'You, me, we and us',
+ imageUrl: 'https://picsum.photos/536/354'
+},
+{
+ name: 'Breakfast news - Dinner edition'
+}
+];
+
+function attachImageToElement(imageUrl, element) {
+ const imgTag = document.createElement("img")
+ imgTag.src = imageUrl
+ element.appendChild(imgTag)
+}
+
+// create list
+const ulTag = document.createElement("ul")
+
+for(podcast of podcasts) {
+ // create many list items
+ const liTag = document.createElement("li")
+
+ // handle name, create, add data, attach
+ const h1Tag = document.createElement("h1")
+ h1Tag.innerText = podcast.name
+ liTag.appendChild(h1Tag)
+
+ // handle image, create, add data, attach
+ if(podcast.imageUrl) {
+ attachImageToElement(podcast.imageUrl, liTag)
+ }
+
+ ulTag.appendChild(liTag)
+}
+
+// append to the dom
+document.body.appendChild(ulTag)
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex3.html b/javascript2/week1/inclass/ex3.html
new file mode 100644
index 00000000..3ad169d4
--- /dev/null
+++ b/javascript2/week1/inclass/ex3.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Super Title
+
+
+
+
+
+
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex3.js b/javascript2/week1/inclass/ex3.js
new file mode 100644
index 00000000..c8a161be
--- /dev/null
+++ b/javascript2/week1/inclass/ex3.js
@@ -0,0 +1,5 @@
+const buttonTag = document.getElementById("eventButton")
+
+buttonTag.addEventListener("click", function(event){
+ event.target.innerText = "Button clicked!"
+})
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex4.html b/javascript2/week1/inclass/ex4.html
new file mode 100644
index 00000000..0b3791c1
--- /dev/null
+++ b/javascript2/week1/inclass/ex4.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+ Super Title
+
+
+
+
Hack your future
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus euismod et ex at molestie. In et nunc nec sapien imperdiet dapibus. Aliquam augue tortor, faucibus sit amet vehicula ultricies, sollicitudin ut sem. Pellentesque viverra aliquet ultricies. Proin odio ligula, tincidunt eu augue ut, convallis interdum diam. Donec aliquet vulputate ligula. Nulla convallis quis magna at pellentesque. Nullam dictum iaculis facilisis. Cras placerat mauris arcu, et ullamcorper mi sodales et.
+
+
+ Morbi turpis enim, egestas quis arcu ac, ornare lacinia nisi. Nam a dui at neque condimentum dignissim eget a eros. Nunc nec dolor consequat mi euismod elementum ac id metus. Suspendisse id ullamcorper arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur rhoncus, dolor euismod consequat tempus, erat augue molestie diam, quis posuere mi ipsum id nisi. Nullam ex nunc, volutpat quis tristique quis, scelerisque sit amet purus. Phasellus vitae urna nulla.
+
+
+ Mauris eu rutrum neque. In at porta ligula, eu suscipit tellus. Etiam ac lacus suscipit, maximus nisl sed, sodales tellus. Quisque nec pretium dui, nec interdum justo. Curabitur fringilla imperdiet fermentum. Sed eget fermentum sapien, in vestibulum nisl. Morbi viverra tellus eget orci luctus, quis efficitur orci sodales. Nullam in egestas risus. Curabitur id ante lectus.
+
+
+ Proin quis dignissim leo. Pellentesque sagittis malesuada mauris ut ultrices. Pellentesque finibus elementum fermentum. Etiam ornare egestas lorem, in lacinia tellus tincidunt eget. Quisque et arcu volutpat, convallis ex eu, vehicula enim. Ut nec malesuada orci, eu congue sem. Sed at ante id purus finibus congue a ac orci. Donec sed ligula eleifend, convallis sem vitae, tempus lorem. Nullam molestie vestibulum libero. Maecenas consectetur vitae turpis sit amet varius. Donec pharetra ullamcorper diam non fermentum. Nam vitae volutpat orci, sed tristique libero. Aliquam erat volutpat. Donec a enim id magna gravida congue sed sed nisl. Etiam quis tortor ac arcu pellentesque pretium at quis felis. Sed posuere id tortor auctor posuere.
+
+
+ Quisque maximus elementum posuere. Pellentesque sagittis imperdiet blandit. Interdum et malesuada fames ac ante ipsum primis in faucibus. Suspendisse potenti. Curabitur dignissim elit eu risus congue rutrum. Ut at vulputate massa, varius sollicitudin lorem. Mauris eu ante odio. Mauris vel fringilla velit. Aenean tempus neque mauris, quis hendrerit urna maximus eu. Mauris lorem ex, iaculis id nunc sit amet, luctus faucibus nibh. Nullam et justo dapibus, vehicula neque non, cursus turpis. Integer et erat pulvinar, semper nisl eu, venenatis erat. Aenean eget magna non urna finibus aliquam. Vivamus commodo ut velit et placerat. Aliquam ut erat sagittis, venenatis ante eget, euismod dolor.
+
+
+
+
\ No newline at end of file
diff --git a/javascript2/week1/inclass/ex4.js b/javascript2/week1/inclass/ex4.js
new file mode 100644
index 00000000..a1400024
--- /dev/null
+++ b/javascript2/week1/inclass/ex4.js
@@ -0,0 +1,14 @@
+const buttonTag = document.getElementById("eventButton")
+const body = document.body
+let isDarkMode = false
+
+buttonTag.addEventListener("click", function(){
+ if(!isDarkMode) {
+ body.style.backgroundColor = "black"
+ body.style.color = "white"
+ } else {
+ body.style.backgroundColor = "white"
+ body.style.color = "black"
+ }
+ isDarkMode = !isDarkMode
+})
\ No newline at end of file
diff --git a/javascript2/week1/inclass/inclass1.html b/javascript2/week1/inclass/inclass1.html
new file mode 100644
index 00000000..eea7902c
--- /dev/null
+++ b/javascript2/week1/inclass/inclass1.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Super Title
+
+
+ Hi this is Peter
+
This is a heading
+
This is a heading number two
+
+
+
+
\ No newline at end of file
diff --git a/javascript2/week1/inclass/inclass1.js b/javascript2/week1/inclass/inclass1.js
new file mode 100644
index 00000000..7e59d693
--- /dev/null
+++ b/javascript2/week1/inclass/inclass1.js
@@ -0,0 +1,23 @@
+// body tag
+const body = document.body
+console.log(body)
+
+// different ways of getting elements
+// const notUsed = document.querySelector("h1")
+const h1Tag = document.getElementById("heading")
+const h1TagByClass = document.getElementsByClassName("bold")
+console.log(h1Tag)
+console.log(h1TagByClass)
+
+// Change properties
+h1Tag.innerText = "Soccer training Wednesday";
+h1Tag.style.backgroundColor = 'blue';
+
+// append new element to DOM
+const divTag = document.createElement('div');
+divTag.innerText = "new div";
+document.body.appendChild(divTag)
+
+// Change img propertie
+const logo = document.getElementById('logo');
+logo.src = "https://assets.fontsinuse.com/static/use-media-items/15/14246/full-2048x768/56fc6e1d/Yahoo_Logo.png?resolution=0";
\ No newline at end of file
diff --git a/javascript2/week1/inclass/inclass2.html b/javascript2/week1/inclass/inclass2.html
new file mode 100644
index 00000000..7076df01
--- /dev/null
+++ b/javascript2/week1/inclass/inclass2.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Super Title
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/javascript2/week1/inclass/inclass2.js b/javascript2/week1/inclass/inclass2.js
new file mode 100644
index 00000000..0aad2bda
--- /dev/null
+++ b/javascript2/week1/inclass/inclass2.js
@@ -0,0 +1,12 @@
+const buttonTag = document.getElementById("eventButton")
+const otherButtonTag = document.getElementById("otherEventButton")
+
+const body = document.body
+
+function changeColor(event) {
+ console.log(event)
+ event.target.style.backgroundColor = 'red';
+}
+
+buttonTag.addEventListener('click', changeColor);
+otherButtonTag.addEventListener('click', changeColor);
\ No newline at end of file
diff --git a/javascript2/week2/inclass/ex1.js b/javascript2/week2/inclass/ex1.js
new file mode 100644
index 00000000..cf0a2b15
--- /dev/null
+++ b/javascript2/week2/inclass/ex1.js
@@ -0,0 +1,59 @@
+function randomIntFromInterval(min, max) {
+ return Math.floor(Math.random() * (max - min + 1) + min);
+}
+function generateListings(numberOfListings) {
+ const listings = [];
+
+ const listingType = ['House', 'Apartment', 'Shed', 'Dorm', 'Farm'];
+ const listingFacilities = ['Parkering', 'Elevator', 'Altan', 'Have', 'Husdyr'];
+
+ for (let i = 0; i < numberOfListings; i++) {
+ const listing = {};
+ const randomTypeIndex = randomIntFromInterval(0, listingType.length - 1);
+ const numberOfFacilities = randomIntFromInterval(1, listingFacilities.length - 1);
+ const facilities = [];
+ for(let i = 0; i < numberOfFacilities; i++) {
+ const randomIndexFacilities = randomIntFromInterval(0, listingFacilities.length - 1);
+ const randomFacility = listingFacilities[randomIndexFacilities];
+
+ if (!(facilities.includes(randomFacility))) {
+ facilities.push(randomFacility);
+ }
+ }
+
+ listing.type = listingType[randomTypeIndex];
+ listing.facilities = facilities;
+ listing.price = randomIntFromInterval(1, 10000);
+ listing.hasGarden = Boolean(randomIntFromInterval(0, 1));
+ listing.size = randomIntFromInterval(12, 1000);
+ listing.img = `https://loremflickr.com/200/200/${listing.type}`
+
+ listings.push(listing);
+ }
+
+ return listings;
+}
+
+const listings = generateListings(37);
+
+listings.forEach(listing => {
+ console.log(listing.size)
+})
+
+const prices = listings
+ .map(listing => listing.prices)
+console.log(prices)
+
+const cheapListings = listings
+ .filter(listing => listing.price < 5000)
+console.log(cheapListings)
+
+const expensivePrices = listings
+ .filter(listing => listing.price > 5000)
+ .map(listing => listing.price)
+console.log(expensivePrices)
+const expensivePrices2 = prices.filter(price => price > 5000)
+
+const parkingListings = listings
+ .filter(listing => listing.facilities.includes("Parkering"))
+console.log(parkingListings)
\ No newline at end of file
diff --git a/javascript2/week2/inclass/ex2.html b/javascript2/week2/inclass/ex2.html
new file mode 100644
index 00000000..72cee833
--- /dev/null
+++ b/javascript2/week2/inclass/ex2.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+ Listings
+
+
+
+
+
+
+
+ Listings
+
+
+
+
Filter options
+
Some quick example text to build on the card title and make up the bulk of the card's content.