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

Commit f86e9c9

Browse files
committed
remove unnecessary coursework; add flipped classroom materials
1 parent f5caf65 commit f86e9c9

File tree

2 files changed

+121
-47
lines changed

2 files changed

+121
-47
lines changed

docs/js-core-1/week-4/homework.md

Lines changed: 71 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,70 @@ title: Coursework
44
sidebar_label: Coursework
55
---
66

7+
## 0) Flipped Classroom Practice (3h)
8+
9+
The video playlist contains some "content" videos and one "practice" video for each content video.
10+
11+
0.1 What does the following code do?
12+
13+
Can you refactor it so that:
14+
15+
- the variables have more understandable names
16+
- the if statements are rewritten into a function with an understandable name
17+
- the whole loop is extracted into a reusable function with an understandable name (test the function by calling it with the values `[3, 12, 6, 11, 2]` and also logging the output)
18+
19+
```js
20+
const c = [13, 4, 10, 7, 1];
21+
const t = [3, 12, 6, 11, 2];
22+
const n = [];
23+
for (const k of c) {
24+
let v = k;
25+
if (k === 13) {
26+
v = "K";
27+
} else if (k === 12) {
28+
v = "Q";
29+
} else if (k === 11) {
30+
v = "J";
31+
} else if (k === 1) {
32+
v = "A";
33+
} else {
34+
v = k;
35+
}
36+
n.push(v);
37+
}
38+
39+
console.log("Your cards are named", n);
40+
```
41+
42+
1.1 Refactor this code to use the `.filter()` array method
43+
44+
```js
45+
const yourCards = [13, 4, 10, 7, 1];
46+
const theirCards = [3, 12, 6, 11, 2];
47+
48+
function getNumberCards(cards) {
49+
const numberCards = [];
50+
for (const card of cards) {
51+
if (card > 1 && card < 11) {
52+
numberCards.push(card);
53+
}
54+
}
55+
return numberCards;
56+
}
57+
58+
console.log("Your number cards are", getNumberCards(yourCards));
59+
console.log("Their number cards are", getNumberCards(theirCards));
60+
```
61+
62+
2.1 Refactor the code from 0.1 above even further to use the `.map()` array method.
63+
64+
3.1 Using `.filter()` and `.map()`, can you write a program that starts with the same `yourCards` and `theirCards` arrays as above and prints out to the console:
65+
66+
```
67+
Your suit cards are [ 'K', 'A' ]
68+
Their suit cards are [ 'Q', 'J' ]
69+
```
70+
771
## 1) Review Solutions for Last Weeks Coursework (30 minutes)
872

973
You should do this every week from now on. We will stop reminding you soon.
@@ -15,70 +79,30 @@ Once you have access to the solutions repo, review your work compared to the exa
1579

1680
Write down your target areas and take them to your buddy group. What does your mentor think? Do they agree with your assessment?
1781

18-
## 2) FreeCodeCamp (4 hours)
19-
20-
You should complete all of these FreeCodeCamp exercises - https://www.freecodecamp.org/learn
21-
22-
- Introduction to the Basic Data Structure Challenges
23-
- Use an Array to Store a Collection of Data
24-
- Access an Array's Contents Using Bracket Notation
25-
- Add Items to an Array with push() and unshift()
26-
- Remove Items from an Array with pop() and shift()
27-
- Remove Items Using splice()
28-
- Add Items Using splice()
29-
- Copy Array Items Using slice()
30-
- Copy an Array with the Spread Operator
31-
- Combine Arrays with the Spread Operator
32-
- Check For The Presence of an Element With indexOf()
33-
- Iterate Through All an Array's Items Using For Loops
34-
- Create complex multi-dimensional arrays
35-
- Add Key-Value Pairs to JavaScript Objects
36-
- Modify an Object Nested Within an Object
37-
- Access Property Names with Bracket Notation
38-
- Use the delete Keyword to Remove Object Properties
39-
- Check if an Object has a Property
40-
- Iterate Through the Keys of an Object with a for...in Statement
41-
- Generate an Array of All Object Keys with Object.keys()
42-
- Modify an Array Stored in an Object
43-
44-
## 3) JavaScript Exercises (3 hours)
45-
46-
Here are a set of exercise that will help you to solidify your knowledge of JavaScript.
47-
48-
For this step, open the "Exercises" folder and complete all of the challenges.
49-
50-
https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week4
51-
52-
Before you start, **make sure you fork the repository** to your Github account.
82+
## 2) JavaScript Challenges (10 hours)
5383

54-
## 4) JavaScript Challenges (10 hours)
55-
56-
Next, in the same repository complete all of the exercises in the "Mandatory" folder.
84+
In the repository for week 4, complete all of the exercises in the "Mandatory" folder.
5785

5886
https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week4
5987

60-
## 5) Module Project
61-
62-
Complete the [module project](../module-project/).
63-
64-
## 6) Codewars (1 hour)
88+
## 3) Codewars (1 hour)
6589

6690
https://docs.codeyourfuture.io/course-processes/running-the-course/codewars
6791

6892
Every week you need to complete at least three kata. Spend at least 20 minutes, three times a week, on your kata workout.
6993

7094
This week, try pairing on a kata with a colleague. We will do more pairing in the next module.
7195

72-
## 8) (Stretch) Extra JavaScript Challenges
96+
## 4) (Stretch) Extra JavaScript Challenges
7397

7498
Have some extra time before our next class? Fill it with these harder challenges to help you stretch your abilities!
7599

76100
**Alert:** Some of these challenges might include concepts that we haven't taught you yet. You should us Google to try to learn how to solve them.
77101

78-
https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week3
102+
https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week4
79103

80-
## 9) Writing a meeting request email (PD - 30 min)
104+
## 5) Writing a meeting request email (PD - 30 min)
81105

82106
In the following scenario imagine you are a recruit for a company and your team leader asks you to write an email requesting a meeting with the Head of Customer Services (HCS). Remember to include the subject line and use appropriate formatting.
83107

84-
"HCS has complained about the customer services application to the software team leader. He has found some frustrating problems with the user interface. The team leader told you to go and see the HCS, find out what is wrong and then come back with improvements. The HCS is very busy. You should email requesting a meeting and outline clearly what you need the meeting for."
108+
"HCS has complained about the customer services application to the software team leader. He has found some frustrating problems with the user interface. The team leader told you to go and see the HCS, find out what is wrong and then come back with improvements. The HCS is very busy. You should email requesting a meeting and outline clearly what you need the meeting for."

docs/js-core-1/week-4/mentors.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Want to make a change to this week but don't have the time? Click [here](https:/
88

99
Want to report a bug in this week? Click [here](https://github.com/CodeYourFuture/syllabus/issues/new?assignees=&labels=bug&template=bug-report.md&title=)
1010

11+
## Coursework
12+
13+
As an alternative to week 4 coursework, some consolidation on week 3 using array methods could be done.
14+
1115
## Questions and Help
1216

1317
We highly recommend joining the relevant Slack Channel for this module. In this channel you can ask questions, get advice from previous teachers and discuss lesson content.
@@ -16,6 +20,52 @@ We highly recommend joining the relevant Slack Channel for this module. In this
1620

1721
For general Syllabus feedback and help you can post in [cyf-syllabus](https://codeyourfuture.slack.com/archives/C012UUW69S8)
1822

23+
## Flipped classroom recap/Q&A
24+
25+
The flipped classroom practice should have trainees
26+
27+
- Refactor code to pull out meaningfully named functions to represent business logic (e.g. `isShortName` instead of `name.length<7`)
28+
- Refactor code to use array methods as appropriate instead of `for ... of`
29+
- `.map()`
30+
- `.filter()`
31+
- As bonus, some minimal explanation of named functions, anonymous functions and arrow functions is given -> not all trainees need to understand it at this stage. They should return to the video when they are ready for it/feel the need for it.
32+
- Note that the following are _not_ currently covered
33+
- `.forEach()` does not tend to have much value over for ... of, so is not covered
34+
- `.reduce()` trainees find a lot of code with reduce on the web and typically cannot adequately explain it
35+
- Not covered but trainees can look up in syllabus or MDN
36+
- `.includes()`
37+
- `.sort()`
38+
- other array methods
39+
40+
Some questions/prompts that may be useful
41+
42+
- What does this program do? (show programs of varying degrees of complexity using `.map()` and `.filter()`)
43+
- When do we use `.map()`?
44+
- When do we use `.filter()`?
45+
- What is the difference between `arr.filter(isBig)` and `arr.filter(isBig())`?
46+
- What is the difference between `.map()` and `.filter()`
47+
- in terms of the result that is output?
48+
- in terms of the function that must be passed
49+
- What are some reasons for refactoring expressions into functions that evaluate to the same thing? e.g.
50+
51+
```js
52+
if (cards.length > 7) {
53+
console.log("you have too many cards in your hand");
54+
}
55+
```
56+
57+
vs
58+
59+
```js
60+
shouldDiscard(cards) {
61+
return cards.length > 7;
62+
}
63+
64+
if (shouldDiscard(cards)) {
65+
console.log("you have too many cards in your hand");
66+
}
67+
```
68+
1969
## Presentations (Out of date, for reference only)
2070

2171
- [Week 3 - JS Core 1 [Google Slides] - 01/05/2020](https://drive.google.com/open?id=1q98KUoX5QQoFEDUl52hLxOnWkoCi2vGrehHjBBEnfdI)

0 commit comments

Comments
 (0)