Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 2a66b91

Browse files
committed
MohammadFakheraJS2W2
1 parent aa59e8a commit 2a66b91

7 files changed

Lines changed: 156 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const hackYourFutureMembers = [
2+
{ name: 'Wouter', age: 33 },
3+
{ name: 'Federico', age: 32 },
4+
{ name: 'Noer', age: 27 },
5+
{ name: 'Tjebbe', age: 22 },
6+
];
7+
const collectiveAge = function(x){
8+
let ageArray = x.map(x=>x=x.age)
9+
let ageSum = ageArray.reduce((cv,cu)=>cv+cu);
10+
return ` The collective age of the HYF team is : ${ageSum}`
11+
};
12+
collectiveAge(hackYourFutureMembers);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const myHobbies = [
2+
'Meditation',
3+
'Reading',
4+
'Programming',
5+
'Hanging out with friends',
6+
'Going to the gym',
7+
];
8+
9+
// creat h1
10+
const head=document.createElement("h1");
11+
head.innerText="My Hobbies List";
12+
const body=document.querySelector("body");
13+
body.appendChild(head);
14+
body.style.cssText="color:purple";
15+
// creat ul
16+
const uList = document.createElement('ul')
17+
body.appendChild(uList);
18+
uList.style.listStyle = 'none'
19+
20+
// creat list
21+
22+
/*for (let i = 0; i <myHobbies.length; i++) {
23+
const list = document.createElement('li');
24+
uList.appendChild(list);
25+
list.innerHTML = myHobbies[i]};*/
26+
27+
myHobbies.forEach(element => { const list = document.createElement('li');
28+
uList.appendChild(list);
29+
list.innerHTML = element
30+
list.style.color="red"
31+
list.style.fontSize="20px"
32+
});
33+
34+
35+
36+
37+
38+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
<script src="favoriteHobbies.js"></script>
10+
</body>
11+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const fruitBasket = ['Apple', 'Lemon', 'Grapefruit', 'Lemon', 'Banana', 'Watermelon', 'Lemon'];
2+
lemonRemover = function(x){
3+
let result= x.filter(x=>x!=='Lemon')
4+
return "My mom bought me a fruit basket, containing : " + result};
5+
let arrayOfFruits=lemonRemover(fruitBasket);
6+
arrayOfFruits;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let doubleEvenNumbers =function (numbers) {
2+
let evenNu= numbers.filter(number=>number%2===0);
3+
const map1 =evenNu.map(x => x * 2);
4+
return map1 };
5+
const myNumbers = [1, 2, 3, 4];
6+
doubleEvenNumbers(myNumbers);// Logs "[4, 8]" to the console
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const mondayTasks = [
2+
{
3+
name: 'Daily standup',
4+
duration: 30, // specified in minutes
5+
},
6+
{
7+
name: 'Feature discussion',
8+
duration: 120,
9+
},
10+
{
11+
name: 'Development time',
12+
duration: 240,
13+
},
14+
{
15+
name: 'Talk to different members from the product team',
16+
duration: 60,
17+
},
18+
];
19+
const youWillPaid = function(x){
20+
21+
const minuetlyRate=25/60;
22+
23+
let paymentArray=x.map(x=>x.duration* minuetlyRate);
24+
25+
26+
let totalPayment=paymentArray.reduce((accumulator, currentValue) => accumulator + currentValue);
27+
28+
return `totalPayment is €${totalPayment}`;
29+
30+
};
31+
youWillPaid(mondayTasks);

‎Week2/homework/pomodoroClock.html‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1">
5+
<style>
6+
p {
7+
text-align: center;
8+
font-size: 60px;
9+
margin-top: 0px;
10+
}
11+
</style>
12+
</head>
13+
<body>
14+
15+
<p id="demo"></p>
16+
17+
<script>
18+
19+
20+
// Set the date we're counting down to
21+
22+
const countDownDate = (new Date().getTime()+(25*1000*60));
23+
24+
// Update the count down every 1 second
25+
var x = setInterval(function() {
26+
27+
// Get today's date and time
28+
var now = new Date().getTime();
29+
30+
// Find the distance between now and the count down date
31+
var distance = countDownDate - now;
32+
33+
// Time calculations for days, hours, minutes and seconds
34+
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
35+
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
36+
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
37+
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
38+
39+
// Output the result in an element with id="demo"
40+
document.getElementById("demo").innerHTML =
41+
+ minutes + "m " + seconds + "s ";
42+
43+
// If the count down is over, write some text
44+
if (distance < 0) {
45+
clearInterval(x);
46+
document.getElementById("demo").innerHTML = "Time's up!";
47+
}
48+
}, 1000);
49+
</script>
50+
51+
</body>
52+
</html>

0 commit comments

Comments
 (0)