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

Commit df08541

Browse files
author
Dedekind561
committed
final sweep of module js2
1 parent e705391 commit df08541

File tree

19 files changed

+112
-253
lines changed

19 files changed

+112
-253
lines changed

week-1/fix/median.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// fix this implementation
2-
// start by running the tests for this function
1+
// Fix this implementation
2+
// Start by running the tests for this function
3+
// If you're in the week-1 directory, you can run npm test -- fix to run the tests in the fix directory
34

45
function calculateMedian(list) {
56
const middleIndex = Math.floor(list.length / 2);

week-1/implement/dedupe.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const dedupe = require("./dedupe.js");
22
/*
33
Dedupe Array
44
5-
📖 Dedupe means deduplicate
5+
📖 Dedupe means **deduplicate**
66
77
In this kata, you will need to deduplicate the elements of an array
88

week-1/implement/max.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* find the maximum element of an array of numbers
1+
/* Find the maximum element of an array of numbers
22
33
In this kata, you will need to implement a function that sums the numerical elements of an array
44

week-1/implement/sum.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* sum the numbers in an array
1+
/* Sum the numbers in an array
22
33
In this kata, you will need to implement a function that sums the numerical elements of an array
44

week-1/readme.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,32 @@ To run tests in the `week-1` directory you can:
1414
1. Change directory into `week-1`
1515
2. Run the tests using `npm test`
1616

17-
## Exercises
17+
## Fix
1818

19-
In this section, you'll have a short program and task. Some of the syntax may be unfamiliar - in this case, you'll need to look things up in documentation.
19+
In this section, you'll have a function and some tests. The function isn't working for all the tests - you'll need to:
2020

21-
## Errors
21+
- run the tests
22+
- interpret the test feedback
23+
- fix the tests
2224

23-
In this section, you'll need to go to each file in `errors` directory and run the file with node to check what the error is. Your task is to interpret the error message and explain why it occurs. The [errors documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors) will help you figure out the solution.
25+
To run the tests for the `fix` directory you can `cd` into `week-1` and run `npm test -- fix`.
2426

25-
## Interpret
27+
## 🔨 Implement
2628

27-
In these tasks, you have to interpret a slightly larger program with some syntax / operators / functions that may be unfamiliar.
28-
You must use documentation to make sense of anything unfamiliar - learning how to look things up this way is a fundamental part of being a developer!
29-
You can also use `console.log` to check the value of different variables in the code.
29+
In this section, you will have a short set of requirements about a function. You will need to implement a function based off this set of requirements. Make sure you check your function works for a number of different inputs.
3030

31-
## Explore - Stretch 💪
31+
Here is a recommended order:
3232

33-
This stretch activity will get you to start exploring new concepts and environments by yourself. It will do so by prompting you to reflect on some questions.
33+
1. `max.test.js`
34+
2. `sum.test.js`
35+
3. `dedupe.test.js`
36+
37+
## 🧹 Refactor
38+
39+
In these problems, you'll be given an implementation and then asked to change it. Once you've updated the implementations you'll need to double check that they are still working!
40+
41+
Once you've completed all these tasks, raise a PR with your work so far. Don't wait to complete your coursework before completing the PR.
42+
43+
## Stretch 💪
44+
45+
Try the more challenging problem from Advent of Code!

week-2/debug/address.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// predict and explain first...
1+
// Predict and explain first...
22

3-
// this code should log out the houseNumber from the address object
3+
// This code should log out the houseNumber from the address object
44
// but it isn't working...
5+
// Fix anything that isn't working
56

67
const address = {
78
houseNumber: 42,

week-2/debug/author.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Predict and explain first...
2+
3+
// This program attempts to log out all the property values in the object.
4+
// But it isn't working. Explain why first and then fix the problem
5+
6+
const author = {
7+
firstName: "Zadie",
8+
lastName: "Smith",
9+
occupation: "writer",
10+
age: 40,
11+
alive: true,
12+
};
13+
14+
for (const value of author) {
15+
console.log(value);
16+
}

week-2/debug/authors.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

week-2/debug/recipe.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// predict and explain first...
1+
// Predict and explain first...
22

33
// This program should log out the title, how many it serves and the ingredients.
44
// Each ingredient should be logged on a new line
@@ -12,4 +12,4 @@ const recipe = {
1212

1313
console.log(`${recipe.title} serves ${recipe.serves}
1414
ingredients:
15-
${recipe}`);
15+
${recipe}`);

week-2/errors/0.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)