Skip to content

Commit f4ee1f3

Browse files
committed
First set of updates
1 parent b1dd861 commit f4ee1f3

26 files changed

+112
-255
lines changed

javascript/introduction-to-js-1/maths/conditional2.html

-73
This file was deleted.

javascript/introduction-to-js-1/maths/editable_canvas.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h2>Editable code</h2>
8686
function drawCanvas() {
8787
ctx.clearRect(0, 0, canvas.width, canvas.height);
8888
eval(textarea.value);
89-
para.textContent = 'The rectangle is ' + x + 'px wide and ' + y + 'px high.';
89+
para.textContent = `The rectangle is ${x}px wide and ${y}px high.`;
9090
}
9191

9292
reset.addEventListener('click', function() {

javascript/introduction-to-js-1/maths/loop.html

-67
This file was deleted.

javascript/introduction-to-js-1/tasks/math/marking.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Finally, you need to write a calculation that checks whether this number is even
1313
The answer should look something like this:
1414

1515
```
16-
let number1 = 4;
17-
let number2 = 8;
18-
let number3 = 12;
19-
let number4 = 8;
16+
const number1 = 4;
17+
const number2 = 8;
18+
const number3 = 12;
19+
const number4 = 8;
2020
21-
let additionResult = number1 + number2;
22-
let subtractionResult = number3 - number4;
21+
const additionResult = number1 + number2;
22+
const subtractionResult = number3 - number4;
2323
2424
finalResult = additionResult * subtractionResult;
2525
@@ -48,9 +48,9 @@ let result2 = 100 / (2 * 6);
4848
4949
result *= result2;
5050
51-
let finalResult = result.toFixed(2);
51+
const finalResult = result.toFixed(2);
5252
53-
let finalNumber = Number(finalResult)
53+
const finalNumber = Number(finalResult);
5454
```
5555

5656
## Task 3
@@ -62,9 +62,9 @@ The test results should be stored inside variables called `weightComparison`, `h
6262
Your code should look something like this:
6363

6464
```
65-
let weightComparison = eleWeight < mouseWeight;
65+
const weightComparison = eleWeight < mouseWeight;
6666
67-
let heightComparison = ostrichHeight > duckHeight;
67+
const heightComparison = ostrichHeight > duckHeight;
6868
69-
let pwdMatch = pwd1 === pwd2;
70-
```
69+
const pwdMatch = pwd1 === pwd2;
70+
```

javascript/introduction-to-js-1/tasks/math/math1-download.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@
3232

3333
// Add your code here
3434

35-
35+
3636

3737
// Don't edit the code below here!
3838

3939
const section = document.querySelector('section');
4040

41-
let para1 = document.createElement('p');
42-
let finalResultCheck = finalResult === 48 ? `Yes, well done!` : `No, it is ${ finalResult }`;
41+
const para1 = document.createElement('p');
42+
const finalResultCheck = finalResult === 48 ? `Yes, well done!` : `No, it is ${ finalResult }`;
4343
para1.textContent = `Is the finalResult 48? ${ finalResultCheck }`;
44-
let para2 = document.createElement('p');
45-
let evenOddResultCheck = evenOddResult === 0 ? 'The final result is even!' : 'The final result is odd. Hrm.'
44+
const para2 = document.createElement('p');
45+
const evenOddResultCheck = evenOddResult === 0 ? 'The final result is even!' : 'The final result is odd. Hrm.'
4646
para2.textContent = evenOddResultCheck;
4747

4848
section.appendChild(para1);

javascript/introduction-to-js-1/tasks/math/math1.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
// Don't edit the code below here!
3737

3838
section.innerHTML = ' ';
39-
let para1 = document.createElement('p');
40-
let finalResultCheck = finalResult === 48 ? `Yes, well done!` : `No, it is ${ finalResult }`;
39+
const para1 = document.createElement('p');
40+
const finalResultCheck = finalResult === 48 ? `Yes, well done!` : `No, it is ${ finalResult }`;
4141
para1.textContent = `Is the finalResult 48? ${ finalResultCheck }`;
42-
let para2 = document.createElement('p');
43-
let evenOddResultCheck = evenOddResult === 0 ? 'The final result is even!' : 'The final result is odd. Hrm.'
42+
const para2 = document.createElement('p');
43+
const evenOddResultCheck = evenOddResult === 0 ? 'The final result is even!' : 'The final result is odd. Hrm.'
4444
para2.textContent = evenOddResultCheck;
4545

4646
section.appendChild(para1);

javascript/introduction-to-js-1/tasks/math/math2-download.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626

2727
</body>
2828
<script>
29-
// Final result should be 10.42
30-
// Add/update your code here
29+
// Final result should be 10.42
30+
// Add/update your code here
3131

32-
let result = 7 + 13 / 9 + 7;
33-
let result2 = 100 / 2 * 6;
32+
let result = 7 + 13 / 9 + 7;
33+
let result2 = 100 / 2 * 6;
3434

3535
// Don't edit the code below here!
3636

3737
const section = document.querySelector('section');
3838

39-
let para1 = document.createElement('p');
39+
const para1 = document.createElement('p');
4040
para1.textContent = `Your finalResult is ${ finalResult }`;
41-
let para2 = document.createElement('p');
42-
let finalNumberCheck = isNaN(finalNumber) === false ? 'finalNumber is a number type. Well done!' : `Ooops! finalNumber is not a number.`;
41+
const para2 = document.createElement('p');
42+
const finalNumberCheck = isNaN(finalNumber) === false ? 'finalNumber is a number type. Well done!' : `Ooops! finalNumber is not a number.`;
4343
para2.textContent = finalNumberCheck;
4444

4545
section.appendChild(para1);

javascript/introduction-to-js-1/tasks/math/math2.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
// Don't edit the code below here!
3535

3636
section.innerHTML = ' ';
37-
let para1 = document.createElement('p');
37+
const para1 = document.createElement('p');
3838
para1.textContent = `Your finalResult is ${ finalResult }`;
39-
let para2 = document.createElement('p');
40-
let finalNumberCheck = isNaN(finalNumber) === false ? 'finalNumber is a number type. Well done!' : `Ooops! finalNumber is not a number.`;
39+
const para2 = document.createElement('p');
40+
const finalNumberCheck = isNaN(finalNumber) === false ? 'finalNumber is a number type. Well done!' : `Ooops! finalNumber is not a number.`;
4141
para2.textContent = finalNumberCheck;
4242

4343
section.appendChild(para1);

javascript/introduction-to-js-1/tasks/math/math3-download.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,30 @@
2727
</body>
2828
<script>
2929
// Statement 1: The elephant weighs less than the mouse
30-
let eleWeight = 1000;
31-
let mouseWeight = 2;
30+
const eleWeight = 1000;
31+
const mouseWeight = 2;
3232

3333
// Statement 2: The Ostrich is taller than the duck
34-
let ostrichHeight = 2;
35-
let duckHeight = 0.3;
34+
const ostrichHeight = 2;
35+
const duckHeight = 0.3;
3636

3737
// Statement 3: The two passwords match
38-
let pwd1 = 'stromboli';
39-
let pwd2 = 'stROmBoLi'
38+
const pwd1 = 'stromboli';
39+
const pwd2 = 'stROmBoLi'
4040

4141
// Add your code here
4242

4343
// Don't edit the code below here!
4444

4545
const section = document.querySelector('section');
4646

47-
let para1 = document.createElement('p');
48-
let para2 = document.createElement('p');
49-
let para3 = document.createElement('p');
47+
const para1 = document.createElement('p');
48+
const para2 = document.createElement('p');
49+
const para3 = document.createElement('p');
5050

51-
let weightTest = weightComparison ? 'True — elephants do weigh less than mice!?' : 'False — of course an elephant is heavier than a mouse!';
52-
let heightTest = heightComparison ? 'True — an ostrich is indeed taller than a duck!' : 'False — apparently a duck is taller than an ostrich!?';
53-
let pwdTest = pwdMatch ? 'True — the passwords match.' : 'False — the passwords do not match; please check them';
51+
const weightTest = weightComparison ? 'True — elephants do weigh less than mice!?' : 'False — of course an elephant is heavier than a mouse!';
52+
const heightTest = heightComparison ? 'True — an ostrich is indeed taller than a duck!' : 'False — apparently a duck is taller than an ostrich!?';
53+
const pwdTest = pwdMatch ? 'True — the passwords match.' : 'False — the passwords do not match; please check them';
5454

5555
para1.textContent = weightTest;
5656
section.appendChild(para1);

javascript/introduction-to-js-1/tasks/math/math3.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@
2626
<textarea class="playable playable-js" style="height: 400px;">
2727

2828
// Statement 1: The elephant weights less than the mouse
29-
let eleWeight = 1000;
30-
let mouseWeight = 2;
29+
const eleWeight = 1000;
30+
const mouseWeight = 2;
3131

3232
// Statement 2: The Ostrich is taller than the duck
33-
let ostrichHeight = 2;
34-
let duckHeight = 0.3;
33+
const ostrichHeight = 2;
34+
const duckHeight = 0.3;
3535

3636
// Statement 3: The two passwords match
37-
let pwd1 = 'stromboli';
38-
let pwd2 = 'stROmBoLi'
37+
const pwd1 = 'stromboli';
38+
const pwd2 = 'stROmBoLi'
3939

4040
// Add your code here
4141

4242
// Don't edit the code below here!
4343

4444
section.innerHTML = ' ';
45-
let para1 = document.createElement('p');
46-
let para2 = document.createElement('p');
47-
let para3 = document.createElement('p');
45+
const para1 = document.createElement('p');
46+
const para2 = document.createElement('p');
47+
const para3 = document.createElement('p');
4848

49-
let weightTest = weightComparison ? 'True — elephants weight less than mice!?' : 'False — of course an elephant is heavier than a mouse!';
50-
let heightTest = heightComparison ? 'True — an ostrich is indeed taller than a duck!' : 'False — apparently a duck is taller than an ostrich!?';
51-
let pwdTest = pwdMatch ? 'True — the passwords match.' : 'False — the passwords do not match; please check them';
49+
const weightTest = weightComparison ? 'True — elephants weight less than mice!?' : 'False — of course an elephant is heavier than a mouse!';
50+
const heightTest = heightComparison ? 'True — an ostrich is indeed taller than a duck!' : 'False — apparently a duck is taller than an ostrich!?';
51+
const pwdTest = pwdMatch ? 'True — the passwords match.' : 'False — the passwords do not match; please check them';
5252

5353
para1.textContent = weightTest;
5454
section.appendChild(para1);

0 commit comments

Comments
 (0)