Skip to content

Commit 911785a

Browse files
triangletrianglesquareplusxgithub-actions[bot]neenjaw
authored
updated hints.md for fruit picker exercise (#1973)
* updated hints.md for fruit picker exercise * [CI] Format code * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> * Update exercises/concept/fruit-picker/.docs/hints.md Co-authored-by: Tim Austin <[email protected]> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Tim Austin <[email protected]>
1 parent 93d366d commit 911785a

File tree

1 file changed

+17
-23
lines changed
  • exercises/concept/fruit-picker/.docs

1 file changed

+17
-23
lines changed

exercises/concept/fruit-picker/.docs/hints.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,28 @@
44

55
- Callback functions are functions passed as an argument to a calling function.
66
- Callback functions must meet the specification of the calling function.
7-
- These callbacks are all synchronous, meaning they all must return a value.
87

9-
## 1. Check if the grocer's service is online
8+
## 1. Notify with a successful message
109

11-
- Use the imported API function `checkStatus` in your function.
12-
- Pass a callback function to `checkStatus`. It should expect to receive a string argument.
13-
- Return the result from the `checkStatus` API function.
10+
- Use the imported API function `notify` in your function.
11+
- Pass an object to `notify`. It should have a property of `message`. Think about what the message value should be.
12+
- Pay attention to the JSDoc type hint -- the function should not return a value.
1413

15-
## 2. See if the grocer has some fruit
14+
## 2. Notify with an error message
1615

17-
- Use the imported API function `checkInventory` in your function.
18-
- Create the query _object_ to pass as an argument.
19-
- Follow the template in the instructions.
20-
- Pass along the callback function to the `checkInventory` API function.
21-
- Return the result from the `checkInventory` API function.
16+
- Use the imported API function `notify` in your function.
17+
- Pass another object to `notify`. It should have a property of `message`. The message value should differ from the last part.
18+
- Pay attention to the comments [JSDoc] above the function definition:
19+
- The function should not return a value.
2220

23-
## 3. Create a callback to buy fruit if the inventory is available
21+
## 3. Place an order to buy fruit
2422

25-
- If the `err` argument is not null, throw a new error using `err`'s message.
26-
- See [Error()][mdn-error-constructor]
27-
- if the `err` is null, ignore it and just respond to the value of `isAvailable`
28-
- This pattern is sometimes called a [`Node.js`-style callback][node-js-callback].
29-
- Return the action determined by `isAvailable`
23+
- Use the already imported `order` function.
24+
- Pay attention to the JSDoc type hints -- the function should receive 3 arguments and not return a value.
25+
- Reuse the previously created callbacks as arguments to the order function.
3026

31-
## 4. Put it all together
27+
## 4. Refactor your work into a more concise function
3228

33-
- Reuse the functions you have already written, composing them together.
34-
- Return the value of the callback function.
35-
36-
[mdn-error-constructor]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Error
37-
[node-js-callback]: https://nodejs.org/en/knowledge/getting-started/control-flow/what-are-callbacks/
29+
- Reuse the functions from the previous tasks.
30+
- Pay attention to the JSDoc type hints -- the function should receive 2 arguments and not return a value.
31+
- Combine the arguments into an object representing the query to the grocer to place an order.

0 commit comments

Comments
 (0)