Skip to content

Commit 79c8499

Browse files
authored
Merge pull request #1549 from microsoft/softchris-patch-8
docs: adding GHCP challenges
2 parents c64300b + cf7c06e commit 79c8499

File tree

22 files changed

+220
-2
lines changed

22 files changed

+220
-2
lines changed

2-js-basics/2-functions-methods/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ When we think about writing code, we always want to ensure our code is readable.
1818

1919
At its core, a function is a block of code we can execute on demand. This is perfect for scenarios where we need to perform the same task multiple times; rather than duplicating the logic in multiple locations (which would make it hard to update when the time comes), we can centralize it in one location, and call it whenever we need the operation performed - you can even call functions from other functions!.
2020

21-
Just as important is the ability to name a function. While this might seem trivial, the name provides a quick way of documenting a section of code. You could think of this as a label on a button. If I click on a button which reads "Cancel timer", I know it's going to stop running the clock.
21+
Just as important is the ability to name a function. While this might seem trivial, the name provides a quick way of documenting a section of code. You could think of this as a label on a button. If I click on a button which reads "Cancel timer", I know it's going to stop running the clock.
2222

2323
## Creating and calling a function
2424

@@ -180,10 +180,25 @@ You've now seen we have three ways to pass a function as a parameter and might b
180180

181181
---
182182

183+
184+
183185
## 🚀 Challenge
184186

185187
Can you articulate in one sentence the difference between functions and methods? Give it a try!
186188

189+
## GitHub Copilot Agent Challenge 🚀
190+
191+
Use the Agent mode to complete the following challenge:
192+
193+
**Description:** Create a utility library of mathematical functions that demonstrates different function concepts covered in this lesson, including parameters, default values, return values, and arrow functions.
194+
195+
**Prompt:** Create a JavaScript file called `mathUtils.js` that contains the following functions:
196+
1. A function `add` that takes two parameters and returns their sum
197+
2. A function `multiply` with default parameter values (second parameter defaults to 1)
198+
3. An arrow function `square` that takes a number and returns its square
199+
4. A function `calculate` that accepts another function as a parameter and two numbers, then applies the function to those numbers
200+
5. Demonstrate calling each function with appropriate test cases
201+
187202
## Post-Lecture Quiz
188203
[Post-lecture quiz](https://ff-quizzes.netlify.app)
189204

2-js-basics/3-making-decisions/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,37 @@ if (firstNumber > secondNumber) {
197197

198198
---
199199

200+
201+
200202
## 🚀 Challenge
201203

202204
Create a program that is written first with logical operators, and then rewrite it using a ternary expression. What's your preferred syntax?
203205

204206
---
205207

208+
## GitHub Copilot Agent Challenge 🚀
209+
210+
Use the Agent mode to complete the following challenge:
211+
212+
**Description:** Create a comprehensive grade calculator that demonstrates multiple decision-making concepts from this lesson, including if-else statements, switch statements, logical operators, and ternary expressions.
213+
214+
**Prompt:** Write a JavaScript program that takes a student's numerical score (0-100) and determines their letter grade using the following criteria:
215+
- A: 90-100
216+
- B: 80-89
217+
- C: 70-79
218+
- D: 60-69
219+
- F: Below 60
220+
221+
Requirements:
222+
1. Use an if-else statement to determine the letter grade
223+
2. Use logical operators to check if the student passes (grade >= 60) AND has honors (grade >= 90)
224+
3. Use a switch statement to provide specific feedback for each letter grade
225+
4. Use a ternary operator to determine if the student is eligible for the next course (grade >= 70)
226+
5. Include input validation to ensure the score is between 0 and 100
227+
228+
Test your program with various scores including edge cases like 59, 60, 89, 90, and invalid inputs.
229+
230+
206231
## Post-Lecture Quiz
207232

208233
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/12)

2-js-basics/4-arrays-loops/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ for (let i = 0; i < iceCreamFlavors.length; i++) {
117117

118118
---
119119

120+
## GitHub Copilot Agent Challenge 🚀
121+
122+
Use the Agent mode to complete the following challenge:
123+
124+
**Description:** Build a data processing function that combines arrays and loops to analyze a dataset.
125+
126+
**Prompt:** Create a function called `analyzeGrades` that takes an array of student grade objects (each containing name and score properties) and returns statistics including the highest score, lowest score, average score, and count of students who passed (score >= 70). Use loops to process the data.
127+
120128
## 🚀 Challenge
121129

122130
There are other ways of looping over arrays other than for and while loops. There are [forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach), [for-of](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/for...of), and [map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map). Rewrite your array loop using one of these techniques.

3-terrarium/1-intro-to-html/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,19 @@ Add this markup above the last `</div>` tag:
217217

218218
---
219219

220+
## GitHub Copilot Agent Challenge 🚀
221+
222+
Use the Agent mode to complete the following challenge:
223+
224+
**Description:** Create a semantic HTML structure for a plant care guide section that could be added to the terrarium project.
225+
226+
**Prompt:** Create a semantic HTML section that includes a main heading "Plant Care Guide", three subsections with headings "Watering", "Light Requirements", and "Soil Care", each containing a paragraph of plant care information. Use proper semantic HTML tags like `<section>`, `<h2>`, `<h3>`, and `<p>` to structure the content appropriately.
227+
220228
## 🚀Challenge
221229

222230
There are some wild 'older' tags in HTML that are still fun to play with, though you shouldn't use deprecated tags such as [these tags](https://developer.mozilla.org/docs/Web/HTML/Element#Obsolete_and_deprecated_elements) in your markup. Still, can you use the old `<marquee>` tag to make the h1 title scroll horizontally? (if you do, don't forget to remove it afterwards)
223231

232+
224233
## Post-Lecture Quiz
225234

226235
[Post-lecture quiz](https://ff-quizzes.netlify.app/web/quiz/16)

3-terrarium/2-intro-to-css/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@ We are also using `rem` for the border-radius, a font-relative length. Read more
249249

250250
---
251251

252+
## GitHub Copilot Agent Challenge 🚀
253+
254+
Use the Agent mode to complete the following challenge:
255+
256+
**Description:** Create a CSS animation that makes the terrarium plants gently sway back and forth, simulating a natural breeze effect. This will help you practice CSS animations, transforms, and keyframes while enhancing the visual appeal of your terrarium.
257+
258+
**Prompt:** Add CSS keyframe animations to make the plants in the terrarium sway gently from side to side. Create a swaying animation that rotates each plant slightly (2-3 degrees) left and right with a duration of 3-4 seconds, and apply it to the `.plant` class. Make sure the animation loops infinitely and has an easing function for natural movement.
259+
260+
---
261+
262+
263+
252264
## 🚀Challenge
253265

254266
Add a 'bubble' shine to the left bottom area of the jar to make it look more glasslike. You will be styling the `.jar-glossy-long` and `.jar-glossy-short` to look like a reflected shine. Here's how it would look:

3-terrarium/3-intro-to-DOM-and-closures/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ Now you have completed your project!
195195

196196
---
197197

198+
## GitHub Copilot Agent Challenge 🚀
199+
200+
Use the Agent mode to complete the following challenge:
201+
202+
**Description:** Enhance the terrarium project by adding a reset functionality that returns all plants to their original positions with smooth animations.
203+
204+
**Prompt:** Create a reset button that, when clicked, animates all plants back to their original sidebar positions using CSS transitions. The function should store the original positions when the page loads and smoothly transition plants back to those positions over 1 second when the reset button is pressed.
205+
198206
## 🚀Challenge
199207

200208
Add new event handler to your closure to do something more to the plants; for example, double-click a plant to bring it to the front. Get creative!

4-typing-game/typing-game/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,21 @@ Click on **start**, and start typing away! It should look a little like the anim
317317

318318
---
319319

320+
## GitHub Copilot Agent Challenge 🎮
321+
322+
Use the Agent mode to complete the following challenge:
323+
324+
**Description:** Extend the typing game by implementing a difficulty system that adjusts the game based on player performance. This challenge will help you practice advanced event handling, data analysis, and dynamic UI updates.
325+
326+
**Prompt:** Create a difficulty adjustment system for the typing game that:
327+
1. Tracks the player's typing speed (words per minute) and accuracy percentage
328+
2. Automatically adjusts to three difficulty levels: Easy (simple quotes), Medium (current quotes), Hard (complex quotes with punctuation)
329+
3. Displays the current difficulty level and player statistics on the UI
330+
4. Implements a streak counter that increases difficulty after 3 consecutive good performances
331+
5. Adds visual feedback (colors, animations) to indicate difficulty changes
332+
333+
Add the necessary HTML elements, CSS styles, and JavaScript functions to implement this feature. Include proper error handling and ensure the game remains accessible with appropriate ARIA labels.
334+
320335
## 🚀 Challenge
321336

322337
Add more functionality

5-browser-extension/1-about-browsers/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ For now, the extension should build and, if you deploy it into Edge as an extens
144144

145145
Congratulations, you've taken the first steps towards building a browser extension. In subsequent lessons, you'll make it more functional and useful.
146146

147+
## GitHub Copilot Agent Challenge 🚀
148+
149+
Use the Agent mode to complete the following challenge:
150+
151+
**Description:** Enhance the browser extension by adding form validation and user feedback features to improve the user experience when entering API keys and region codes.
152+
153+
**Prompt:** Create JavaScript validation functions that check if the API key field contains at least 20 characters and if the region code follows the correct format (like 'US-NEISO'). Add visual feedback by changing input border colors to green for valid inputs and red for invalid ones. Also add a toggle feature to show/hide the API key for security purposes.
154+
147155
---
148156

149157
## 🚀 Challenge

5-browser-extension/2-forms-browsers-local-storage/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ Congratulations! If you build your extension (`npm run build`) and refresh it in
206206

207207
---
208208

209+
## GitHub Copilot Agent Challenge 🚀
210+
211+
Use the Agent mode to complete the following challenge:
212+
213+
**Description:** Enhance the browser extension by adding error handling improvements and user experience features. This challenge will help you practice working with APIs, local storage, and DOM manipulation using modern JavaScript patterns.
214+
215+
**Prompt:** Create an enhanced version of the displayCarbonUsage function that includes: 1) A retry mechanism for failed API calls with exponential backoff, 2) Input validation for the region code before making the API call, 3) A loading animation with progress indicators, 4) Caching of API responses in localStorage with expiration timestamps (cache for 30 minutes), and 5) A feature to display historical data from previous API calls. Also add proper TypeScript-style JSDoc comments to document all function parameters and return types.
216+
209217
## 🚀 Challenge
210218

211219
We've discussed several types of API so far in these lessons. Choose a web API and research in depth what it offers. For example, take a look at APIs available within browsers such as the [HTML Drag and Drop API](https://developer.mozilla.org/docs/Web/API/HTML_Drag_and_Drop_API). What makes a great API in your opinion?

5-browser-extension/3-background-tasks-and-performance/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,18 @@ Now, rebuild your extension (`npm run build`), refresh and launch your extension
139139

140140
Congratulations, you've built a useful browser extension and learned more about how the browser works and how to profile its performance.
141141

142+
## GitHub Copilot Agent Challenge 🚀
143+
144+
Use the Agent mode to complete the following challenge:
145+
146+
**Description:** Enhance the browser extension's performance monitoring capabilities by adding a feature that tracks and displays load times for different components of the extension.
147+
148+
**Prompt:** Create a performance monitoring system for the browser extension that measures and logs the time it takes to fetch CO2 data from the API, calculate colors, and update the icon. Add a function called `performanceTracker` that uses the Performance API to measure these operations and displays the results in the browser console with timestamps and duration metrics.
149+
142150
---
143151

152+
153+
144154
## 🚀 Challenge
145155

146156
Investigate some open source websites that have been around a long time ago, and, based on their GitHub history, see if you can determine how they were optimized over the years for performance, if at all. What is the most common pain point?

0 commit comments

Comments
 (0)