diff --git a/Week1/homework/app.js b/Week1/homework/app.js deleted file mode 100644 index a9b5f75d8..000000000 --- a/Week1/homework/app.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -{ - const bookTitles = [ - // Replace with your own book titles - 'harry_potter_chamber_secrets', - ]; - - // Replace with your own code - console.log(bookTitles); -} diff --git a/Week1/homework/index.html b/Week1/homework/index.html deleted file mode 100644 index b22147cd1..000000000 --- a/Week1/homework/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Week1/homework/js-exercises/0.jpg b/Week1/homework/js-exercises/0.jpg new file mode 100644 index 000000000..fdceb5cd1 Binary files /dev/null and b/Week1/homework/js-exercises/0.jpg differ diff --git a/Week1/homework/js-exercises/1.jpg b/Week1/homework/js-exercises/1.jpg new file mode 100644 index 000000000..b92aa356d Binary files /dev/null and b/Week1/homework/js-exercises/1.jpg differ diff --git a/Week1/homework/js-exercises/2.jpg b/Week1/homework/js-exercises/2.jpg new file mode 100644 index 000000000..b8d6b03b6 Binary files /dev/null and b/Week1/homework/js-exercises/2.jpg differ diff --git a/Week1/homework/js-exercises/about_me.html b/Week1/homework/js-exercises/about_me.html new file mode 100644 index 000000000..111234cb5 --- /dev/null +++ b/Week1/homework/js-exercises/about_me.html @@ -0,0 +1,45 @@ + + + + + About Me + + +

About Me

+ + + + + \ No newline at end of file diff --git a/Week1/homework/js-exercises/hijackGoogleLogo.js b/Week1/homework/js-exercises/hijackGoogleLogo.js new file mode 100644 index 000000000..55c3ce57b --- /dev/null +++ b/Week1/homework/js-exercises/hijackGoogleLogo.js @@ -0,0 +1,6 @@ +function hijackGoogleLogo() { + const googleLogo = document.getElementById('hplogo'); + googleLogo.src = 'https://www.hackyourfuture.dk/static/logo-dark.svg'; + googleLogo.srcset = 'https://www.hackyourfuture.dk/static/logo-dark.svg'; +}; +hijackGoogleLogo(); \ No newline at end of file diff --git a/Week1/homework/js-exercises/me.png b/Week1/homework/js-exercises/me.png new file mode 100644 index 000000000..fbc109c0e Binary files /dev/null and b/Week1/homework/js-exercises/me.png differ diff --git a/Week1/homework/js-exercises/randomQuoteGenerator.html b/Week1/homework/js-exercises/randomQuoteGenerator.html new file mode 100644 index 000000000..3d0ed08e1 --- /dev/null +++ b/Week1/homework/js-exercises/randomQuoteGenerator.html @@ -0,0 +1,170 @@ + + + + + + Random Quote Generator + + + + +
+
+

+ Quotes are here! +

+

+ Author is here!

+
+
+ + +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + diff --git a/Week1/homework/js-exercises/showCurrentTime.js b/Week1/homework/js-exercises/showCurrentTime.js new file mode 100644 index 000000000..61ec5caa3 --- /dev/null +++ b/Week1/homework/js-exercises/showCurrentTime.js @@ -0,0 +1,25 @@ + +window.onload = setInterval(startTime, 1000 ); + + +const body = document.querySelector('body'); +let currentTime = document.createElement('h1'); +currentTime.style = "width: 20%; margin: auto; display: block; text-align: center;" +body.appendChild(currentTime); + +function startTime(){ + + let today = new Date(); + let h = today.getHours(); + let m = correctTime(today.getMinutes()); + let s = correctTime(today.getSeconds()); + currentTime.innerHTML = h + ":" + m + ":" + s; +} + + +function correctTime(i) { + if (i < 10) { + i = "0" + i + } + return i; + } diff --git a/Week1/homework/js-exercises/theBookList.html b/Week1/homework/js-exercises/theBookList.html new file mode 100644 index 000000000..6d7d7a75d --- /dev/null +++ b/Week1/homework/js-exercises/theBookList.html @@ -0,0 +1,76 @@ + + + + + the book list + + + + + + + + + \ No newline at end of file diff --git a/Week1/homework/js-exercises/theCatWalk.html b/Week1/homework/js-exercises/theCatWalk.html new file mode 100644 index 000000000..116a83337 --- /dev/null +++ b/Week1/homework/js-exercises/theCatWalk.html @@ -0,0 +1,40 @@ + + + + + Cat Walk + + + + + + \ No newline at end of file diff --git a/Week1/homework/js-exercises/time.html b/Week1/homework/js-exercises/time.html new file mode 100644 index 000000000..c6d301bf2 --- /dev/null +++ b/Week1/homework/js-exercises/time.html @@ -0,0 +1,13 @@ + + + + + + + Show the current time + + + + + + \ No newline at end of file diff --git a/Week1/homework/style.css b/Week1/homework/style.css deleted file mode 100644 index bab13ec23..000000000 --- a/Week1/homework/style.css +++ /dev/null @@ -1 +0,0 @@ -/* add your styling here */ \ No newline at end of file diff --git a/Week2/homework/js-exercise/collectiveAge.js b/Week2/homework/js-exercise/collectiveAge.js new file mode 100644 index 000000000..97aaa1bfb --- /dev/null +++ b/Week2/homework/js-exercise/collectiveAge.js @@ -0,0 +1,12 @@ +const hackYourFutureMembers = [ + { name: 'Wouter', age: 33 }, + { name: 'Federico', age: 32 }, + { name: 'Noer', age: 27 }, + { name: 'Tjebbe', age: 22 }, + ]; + const collectiveAge = function(x){ + let ageArray = x.map(x=>x=x.age) + let ageSum = ageArray.reduce((cv,cu)=>cv+cu); + return ` The collective age of the HYF team is : ${ageSum}` + }; + collectiveAge(hackYourFutureMembers); \ No newline at end of file diff --git a/Week2/homework/js-exercise/favoriteHobbies.js b/Week2/homework/js-exercise/favoriteHobbies.js new file mode 100644 index 000000000..d4db30f80 --- /dev/null +++ b/Week2/homework/js-exercise/favoriteHobbies.js @@ -0,0 +1,38 @@ +const myHobbies = [ + 'Meditation', + 'Reading', + 'Programming', + 'Hanging out with friends', + 'Going to the gym', + ]; + + // creat h1 + const head=document.createElement("h1"); + head.innerText="My Hobbies List"; + const body=document.querySelector("body"); + body.appendChild(head); + body.style.cssText="color:purple"; + // creat ul + const uList = document.createElement('ul') + body.appendChild(uList); + uList.style.listStyle = 'none' + + // creat list + + /*for (let i = 0; i { const list = document.createElement('li'); + uList.appendChild(list); + list.innerHTML = element + list.style.color="red" + list.style.fontSize="20px" + }); + + + + + + diff --git a/Week2/homework/js-exercise/html.html b/Week2/homework/js-exercise/html.html new file mode 100644 index 000000000..1594caf89 --- /dev/null +++ b/Week2/homework/js-exercise/html.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/Week2/homework/js-exercise/lemonAllergy.js b/Week2/homework/js-exercise/lemonAllergy.js new file mode 100644 index 000000000..d5990cab2 --- /dev/null +++ b/Week2/homework/js-exercise/lemonAllergy.js @@ -0,0 +1,6 @@ +const fruitBasket = ['Apple', 'Lemon', 'Grapefruit', 'Lemon', 'Banana', 'Watermelon', 'Lemon']; +lemonRemover = function(x){ + let result= x.filter(x=>x!=='Lemon') + return "My mom bought me a fruit basket, containing : " + result}; + let arrayOfFruits=lemonRemover(fruitBasket); + arrayOfFruits; \ No newline at end of file diff --git a/Week2/homework/js-exercise/theOddOnesOut.js b/Week2/homework/js-exercise/theOddOnesOut.js new file mode 100644 index 000000000..0a3652ea0 --- /dev/null +++ b/Week2/homework/js-exercise/theOddOnesOut.js @@ -0,0 +1,6 @@ +let doubleEvenNumbers =function (numbers) { +let evenNu= numbers.filter(number=>number%2===0); + const map1 =evenNu.map(x => x * 2); + return map1 }; + const myNumbers = [1, 2, 3, 4]; +doubleEvenNumbers(myNumbers);// Logs "[4, 8]" to the console \ No newline at end of file diff --git a/Week2/homework/js-exercise/yourMonday.js b/Week2/homework/js-exercise/yourMonday.js new file mode 100644 index 000000000..a8919a1d4 --- /dev/null +++ b/Week2/homework/js-exercise/yourMonday.js @@ -0,0 +1,31 @@ +const mondayTasks = [ + { + name: 'Daily standup', + duration: 30, // specified in minutes + }, + { + name: 'Feature discussion', + duration: 120, + }, + { + name: 'Development time', + duration: 240, + }, + { + name: 'Talk to different members from the product team', + duration: 60, + }, + ]; + const youWillPaid = function(x){ + + const minuetlyRate=25/60; + + let paymentArray=x.map(x=>x.duration* minuetlyRate); + + + let totalPayment=paymentArray.reduce((accumulator, currentValue) => accumulator + currentValue); + + return `totalPayment is €${totalPayment}`; + + }; + youWillPaid(mondayTasks); \ No newline at end of file diff --git a/Week2/homework/pomodoroClock.html b/Week2/homework/pomodoroClock.html new file mode 100644 index 000000000..a02f76409 --- /dev/null +++ b/Week2/homework/pomodoroClock.html @@ -0,0 +1,52 @@ + + + + + + + + +

+ + + + + diff --git a/Week3/homework/addSix.js b/Week3/homework/addSix.js new file mode 100644 index 000000000..202f182c2 --- /dev/null +++ b/Week3/homework/addSix.js @@ -0,0 +1,8 @@ +function createBase() { + // Put here your logic... + } + + const addSix = createBase(6); + + // Put here your function calls... + addSix(); \ No newline at end of file diff --git a/Week3/homework/guessMore.js b/Week3/homework/guessMore.js new file mode 100644 index 000000000..89bfd00d0 --- /dev/null +++ b/Week3/homework/guessMore.js @@ -0,0 +1,16 @@ +// Snippet +const x = 9; +function f1(val) { + val = val + 1; + return val; +} +f1(x);// the value of f1(x) is 10 +console.log(x);// the value of x is 9 + +const y = { x: 9 }; //y is an object +function f2(val) { + val.x = val.x + 1; + return val; //the value of f1(x) is 10 , so the f2 will return x+1 +} +f2(y);//the value of f2(x) 11 +console.log(y); //the value of y {x: 10} \ No newline at end of file diff --git a/Week3/homework/guessTheOutput.js b/Week3/homework/guessTheOutput.js new file mode 100644 index 000000000..ef6c85e9c --- /dev/null +++ b/Week3/homework/guessTheOutput.js @@ -0,0 +1,14 @@ +// Snippet +let a = 10; +const x = (function() { + a = 12; + return function() { + alert(a); + }; +})(); + +x(); +/* +x is assigned to a function in row 3 and the function is wrapped with two parentheses and follwoed by () so +the function will be declared and excuted , x() will alert 12 in browser window . + */ \ No newline at end of file diff --git a/Week3/homework/lottery.js b/Week3/homework/lottery.js new file mode 100644 index 000000000..2a085ea4e --- /dev/null +++ b/Week3/homework/lottery.js @@ -0,0 +1,21 @@ +arrayGenerator =function (startIndex, stopIndex,byThree,byFive) { + let y= Array(stopIndex- startIndex + 1).fill().map((_, idx) => startIndex + idx) + + + +const arrSum = arr => arr.reduce((a,b) => a + b, 0) +let b = arrSum(y) +byFifteen=function(){ + alert("the sum of the enterd array is devideble by 3&5") +} +byThree=function(){ + alert("the sum of the enterd array is devideble by 3") +} +byFive=function(){ + alert("the sum of the enterd array is devideble by 5") +} + +if(b%15===0){return byFifteen() } +else if(b%5===0){return byFive()} +else if(b%3===0){return byThree()} +} diff --git a/Week3/homework/step2-1.js b/Week3/homework/step2-1.js deleted file mode 100644 index d5699882c..000000000 --- a/Week3/homework/step2-1.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -function foo(func) { - // What to do here? - // Replace this comment and the next line with your code - console.log(func); -} - -function bar() { - console.log('Hello, I am bar!'); -} - -foo(bar); - -// Do not change or remove anything below this line -module.exports = foo; diff --git a/Week3/homework/step2-2.js b/Week3/homework/step2-2.js deleted file mode 100644 index dcd135040..000000000 --- a/Week3/homework/step2-2.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -function threeFive(startIndex, stopIndex, threeCallback, fiveCallback) { - const numbers = []; - - // Replace this comment and the next line with your code - console.log(startIndex, stopIndex, threeCallback, fiveCallback, numbers); -} - -function sayThree(number) { - // Replace this comment and the next line with your code - console.log(number); -} - -function sayFive(number) { - // Replace this comment and the next line with your code - console.log(number); -} - -threeFive(10, 15, sayThree, sayFive); - -// Do not change or remove anything below this line -module.exports = threeFive; diff --git a/Week3/homework/step2-3.js b/Week3/homework/step2-3.js deleted file mode 100644 index 00845c5eb..000000000 --- a/Week3/homework/step2-3.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -// Use a 'for' loop -function repeatStringNumTimesWithFor(str, num) { - // eslint-disable-next-line prefer-const - let result = ''; - - // Replace this comment and the next line with your code - console.log(str, num, result); - - return result; -} - -console.log('for', repeatStringNumTimesWithFor('abc', 3)); - -// Use a 'while' loop -function repeatStringNumTimesWithWhile(str, num) { - // eslint-disable-next-line prefer-const - let result = ''; - - // Replace this comment and the next line with your code - console.log(str, num, result); - - return result; -} - -console.log('while', repeatStringNumTimesWithWhile('abc', 3)); - -// Use a 'do...while' loop -function repeatStringNumTimesWithDoWhile(str, num) { - // eslint-disable-next-line prefer-const - let result = ''; - - // Replace this comment and the next line with your code - console.log(str, num, result); - - return result; -} - -console.log('do-while', repeatStringNumTimesWithDoWhile('abc', 3)); - -// Do not change or remove anything below this line -module.exports = { - repeatStringNumTimesWithFor, - repeatStringNumTimesWithWhile, - repeatStringNumTimesWithDoWhile, -}; diff --git a/Week3/homework/step2-4.js b/Week3/homework/step2-4.js deleted file mode 100644 index b11b1dcb6..000000000 --- a/Week3/homework/step2-4.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -function Dog() { - // add your code here -} - -const hound = new Dog(); - -// Do not change or remove anything below this line -module.exports = hound; diff --git a/Week3/homework/step2-5.js b/Week3/homework/step2-5.js deleted file mode 100644 index cbb54fa1d..000000000 --- a/Week3/homework/step2-5.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -function multiplyAll(arr) { - // eslint-disable-next-line - let product = 1; - - // Replace this comment and the next line with your code - console.log(arr, product); - - return product; -} - -const result = multiplyAll([[1, 2], [3, 4], [5, 6]]); -console.log(result); // 720 - -// Do not change or remove anything below this line -module.exports = multiplyAll; diff --git a/Week3/homework/step2-6.js b/Week3/homework/step2-6.js deleted file mode 100644 index ffe95b9f7..000000000 --- a/Week3/homework/step2-6.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -const arr2d = [[1, 2], [3, 4], [5, 6]]; -const arr3d = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]; - -function flattenArray2d(arr) { - // Replace this comment and the next line with your code - console.log(arr); -} - -function flattenArray3d(arr) { - // Replace this comment and the next line with your code - console.log(arr); -} - -console.log(flattenArray2d(arr2d)); // -> [1, 2, 3, 4, 5, 6] -console.log(flattenArray3d(arr3d)); // -> [1, 2, 3, 4, 5, 6, 7, 8] - -// Do not change or remove anything below this line -module.exports = { - flattenArray2d, - flattenArray3d, -}; diff --git a/Week3/homework/step2-7.js b/Week3/homework/step2-7.js deleted file mode 100644 index 3e72e8551..000000000 --- a/Week3/homework/step2-7.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -const x = 9; -function f1(val) { - val = val + 1; - return val; -} - -f1(x); - -console.log(x); - -const y = { x: 9 }; -function f2(val) { - val.x = val.x + 1; - return val; -} - -f2(y); - -console.log(y); - -// Add your explanation as a comment here diff --git a/Week3/homework/step3-bonus.js b/Week3/homework/step3-bonus.js deleted file mode 100644 index 917091d61..000000000 --- a/Week3/homework/step3-bonus.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -const values = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c']; - -function makeUnique(arr) { - // Replace this comment and the next line with your code - console.log(arr); -} - -const uniqueValues = makeUnique(values); -console.log(uniqueValues); - -// Do not change or remove anything below this line -module.exports = makeUnique; diff --git a/Week3/homework/step3.js b/Week3/homework/step3.js deleted file mode 100644 index 292724bf4..000000000 --- a/Week3/homework/step3.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -function createBase(base) { - // Replace this comment and the next line with your code - console.log(base); -} - -const addSix = createBase(6); - -console.log(addSix(10)); // returns 16 -console.log(addSix(21)); // returns 27 - -// Do not change or remove anything below this line -module.exports = createBase; diff --git a/Week3/homework/takeOutTheDuplicates.js b/Week3/homework/takeOutTheDuplicates.js new file mode 100644 index 000000000..d8bf14922 --- /dev/null +++ b/Week3/homework/takeOutTheDuplicates.js @@ -0,0 +1,5 @@ +const letters = ['a', 'b', 'c', 'd', 'a', 'e', 'f', 'c', 'b']; + +// Set only allows unique values, all duplicates will be removed. +const uniqueSet= Array.from(new Set (letters)); + diff --git a/Week3/homework/theTipCalculator.html b/Week3/homework/theTipCalculator.html new file mode 100644 index 000000000..213002bd3 --- /dev/null +++ b/Week3/homework/theTipCalculator.html @@ -0,0 +1,112 @@ + + + + + + The tip calculator + + + + + +
+
+

The Tip calculator

+
+

How much was your bill?

+
+ + +

How was your service?

+ +

How many persons are sharing the bill?

+
+ +
+
+ + +

Tip Amount

+

+ +
+
+ + + + + \ No newline at end of file