Skip to content

Commit 2ead81e

Browse files
Add exercise solutions and copy of code
0 parents  commit 2ead81e

File tree

214 files changed

+6135
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+6135
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.vscode

1-exercise-solutions/lesson-01/1a.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alert('Good morning!');

1-exercise-solutions/lesson-01/1b.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alert('Simon');

1-exercise-solutions/lesson-01/1c.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10 + 5

1-exercise-solutions/lesson-01/1d.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20 - 5

1-exercise-solutions/lesson-01/1e.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2 + 2 - 5

1-exercise-solutions/lesson-01/1f.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
document.body.innerHTML = 'Good morning!';

1-exercise-solutions/lesson-01/1g.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
document.body.innerHTML = 'Simon';

1-exercise-solutions/lesson-01/1h.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10 + 8 + 20

1-exercise-solutions/lesson-01/1i.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
100 - 50 - 20 + 200

1-exercise-solutions/lesson-01/1j.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
document.body.innerHTML = '';

1-exercise-solutions/lesson-02/2a.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10 + 3 * 8 + 5

1-exercise-solutions/lesson-02/2b.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(10 + 3 * 8 + 5) / 3

1-exercise-solutions/lesson-02/2c.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18.5 + 2 * 7.5

1-exercise-solutions/lesson-02/2d.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(18.5 + 2 * 7.5) * 0.1

1-exercise-solutions/lesson-02/2e.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(18.5 + 2 * 7.5) * 0.2

1-exercise-solutions/lesson-02/2f.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(2095 + 799 + 1899) / 100

1-exercise-solutions/lesson-02/2g.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(2095 + 799 + 1899 + 499) / 100

1-exercise-solutions/lesson-02/2h.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Math.round((2095 + 799 + 1899 + 499) * 0.1) / 100

1-exercise-solutions/lesson-02/2i.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(2095 + 799 + 1899 + 499) / 100 + Math.round((2095 + 799 + 1899 + 499) * 0.1) / 100

1-exercise-solutions/lesson-02/2j.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Math.floor(2.8)

1-exercise-solutions/lesson-02/2k.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Math.ceil(2.2)

1-exercise-solutions/lesson-02/2l.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(25 * 9 / 5) + 32

1-exercise-solutions/lesson-02/2m.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(86 - 32) * 5 / 9

1-exercise-solutions/lesson-02/2n.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(-5 * 9 / 5) + 32

1-exercise-solutions/lesson-03/3a.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'My name is: '

1-exercise-solutions/lesson-03/3b.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'Simon'

1-exercise-solutions/lesson-03/3c.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'My name is: ' + 'Simon'

1-exercise-solutions/lesson-03/3d.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'Total cost: $' + (5 + 3)

1-exercise-solutions/lesson-03/3e.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`Total cost: $${5 + 3}`

1-exercise-solutions/lesson-03/3f.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alert(`Total cost: $${5 + 3}`);

1-exercise-solutions/lesson-03/3g.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'Total cost: $' + (599 + 295) / 100

1-exercise-solutions/lesson-03/3h.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`Total cost: $${(599 + 295) / 100}`

1-exercise-solutions/lesson-03/3i.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alert(`Total cost: $${(599 + 295) / 100}`);

1-exercise-solutions/lesson-03/3j.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
alert(`Total cost: $${(599 + 295) / 100}
2+
Thank you, come again!`);

1-exercise-solutions/lesson-03/3k.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`Items (${2 + 2}): $${(2 * 2095 + 2 * 799) / 100}`

1-exercise-solutions/lesson-03/3l.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`Shipping & handling: $${(499 + 499) / 100}`

1-exercise-solutions/lesson-03/3m.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`Total before tax: $${(2 * 2095 + 2 * 799 + 499 + 499) / 100}`

1-exercise-solutions/lesson-03/3n.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`Estimated tax (10%): $${Math.round((2 * 2095 + 2 * 799 + 499 + 499) * 0.1) / 100}`
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<button>Click</button>
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<button>Simon</button>
2+
<button>chocolate</button>
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>Hello, world!</p>
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<p>Hello, world!</p>
2+
<p>Today I went to the grocery store to buy some eggs and vegetables.</p>
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<style>
2+
.add-to-cart-button {
3+
background-color: yellow;
4+
}
5+
6+
.buy-now-button {
7+
background-color: orange;
8+
}
9+
</style>
10+
11+
<button class="add-to-cart-button">Add to cart</button>
12+
<button class="buy-now-button">Buy now</button>
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.add-to-cart-button {
6+
background-color: yellow;
7+
}
8+
9+
.buy-now-button {
10+
background-color: orange;
11+
}
12+
</style>
13+
</head>
14+
<body>
15+
<button class="add-to-cart-button">Add to cart</button>
16+
<button class="buy-now-button">Buy now</button>
17+
</body>
18+
</html>
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Buttons</title>
5+
<style>
6+
.add-to-cart-button {
7+
background-color: yellow;
8+
}
9+
10+
.buy-now-button {
11+
background-color: orange;
12+
}
13+
</style>
14+
</head>
15+
<body>
16+
<button class="add-to-cart-button">Add to cart</button>
17+
<button class="buy-now-button">Buy now</button>
18+
</body>
19+
</html>
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Buttons</title>
5+
<style>
6+
.add-to-cart-button {
7+
background-color: yellow;
8+
}
9+
10+
.buy-now-button {
11+
background-color: orange;
12+
}
13+
</style>
14+
</head>
15+
<body>
16+
<button class="add-to-cart-button">Add to cart</button>
17+
<button class="buy-now-button">Buy now</button>
18+
19+
<script>
20+
console.log('Welcome!');
21+
</script>
22+
</body>
23+
</html>
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.add-to-cart-button {
6+
background-color: yellow;
7+
}
8+
9+
.buy-now-button {
10+
background-color: orange;
11+
}
12+
</style>
13+
</head>
14+
<body>
15+
<p>Adults Plain Cotton T-shirt</p>
16+
<p>Price: $7.99</p>
17+
<button class="add-to-cart-button">Add to cart</button>
18+
<button class="buy-now-button">Buy now</button>
19+
</body>
20+
</html>
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.add-to-cart-button {
6+
background-color: yellow;
7+
}
8+
9+
.buy-now-button {
10+
background-color: orange;
11+
}
12+
</style>
13+
</head>
14+
<body>
15+
<p>Adults Plain Cotton T-shirt</p>
16+
<p>Price: $7.99</p>
17+
18+
<!-- I added some extra spaces to make the code
19+
easier to read. -->
20+
<button class="add-to-cart-button" onclick="
21+
alert('Added');
22+
">Add to cart</button>
23+
24+
<button class="buy-now-button" onclick="
25+
alert('Loading...');
26+
alert('Purchased');
27+
">Buy now</button>
28+
</body>
29+
</html>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const name = 'Simon';
7+
</script>
8+
</body>
9+
</html>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const name = 'Simon';
7+
console.log(`My name is: ${name}`);
8+
</script>
9+
</body>
10+
</html>
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const cost = 5 + 2 * 3 + 9;
7+
</script>
8+
</body>
9+
</html>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const cost = 5 + 2 * 3 + 9;
7+
console.log(`Cost of food: $${cost}`);
8+
</script>
9+
</body>
10+
</html>
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const cost = 5 + 2 * 3 + 9;
7+
console.log(`Cost of food: $${cost}`);
8+
9+
const tax = cost * 0.1;
10+
</script>
11+
</body>
12+
</html>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const cost = 5 + 2 * 3 + 9;
7+
console.log(`Cost of food: $${cost}`);
8+
9+
const tax = cost * 0.1;
10+
console.log(`Tax (10%): $${tax}`);
11+
</script>
12+
</body>
13+
</html>
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head></head>
4+
<body>
5+
<script>
6+
const cost = 5 + 2 * 3 + 9;
7+
console.log(`Cost of food: $${cost}`);
8+
9+
const tax = cost * 0.1;
10+
console.log(`Tax (10%): $${tax}`);
11+
12+
const totalCost = cost + tax;
13+
console.log(`Total cost: $${totalCost}`);
14+
</script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)