You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add floating point precision note to let/const exercise
- Add MDN links for null and undefined
- Add hint about nested loops for star staircase pattern
- Add callout explaining callbacks and higher-order functions
- Note that TypeScript provides type info, so JSDoc is for descriptions
- Clarify never type exercise to explicitly mention using throwError function
Copy file name to clipboardExpand all lines: exercises/04.control-flow/03.problem.loops/README.mdx
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,20 @@ for (...) {
26
26
}
27
27
```
28
28
29
+
💰 You'll need **two loops** for this exercise—an outer loop for each row, and
30
+
an inner loop to build the stars for that row. This is called a "nested loop":
31
+
32
+
```ts
33
+
for (let row =1; row<=5; row++) {
34
+
// inner loop builds stars for this row
35
+
for (let star =0; star<row; star++) {
36
+
// add a star
37
+
}
38
+
}
39
+
```
40
+
29
41
📜 [MDN - for statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)
30
42
43
+
📜 [MDN - for...of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) (an alternative loop syntax you'll see in the wild)
44
+
31
45
🐨 Once you've completed the exercise, run `node index.ts` in the playground to test your work!
0 commit comments