Skip to content

Commit 98a7ab1

Browse files
committed
Remove manual line wrapping from problem descriptions.
1 parent 7215ba0 commit 98a7ab1

File tree

18 files changed

+72
-157
lines changed

18 files changed

+72
-157
lines changed

problems/async_loops/problem.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
This code is broken!
22

3-
A Java developer has committed this terrible code to our codebase
4-
and didn't test it!
3+
A Java developer has committed this terrible code to our codebase and didn't test it!
54

65
```js
76
function loadUsers(userIds, load, done) {
@@ -15,14 +14,14 @@ function loadUsers(userIds, load, done) {
1514
module.exports = loadUsers
1615
```
1716

18-
# Task: Fix this code! The callback should be called with all the users loaded.
19-
The order of the users should match the order of supplied user ids.
20-
Because this function is asynchronous, we do not care about its return value.
17+
# Task
18+
19+
Fix this code! The callback should be called with all the users loaded.
20+
The order of the users should match the order of supplied user ids. Because this function is asynchronous, we do not care about its return value.
2121

2222
## Arguments
2323
* userIds: an Array of numeric user ids.
24-
* load: a Function used to load user objects. Expects a numeric id and a callback. The callback will be called with the
25-
result of loading the user with the specified id (either a user object or null).
24+
* load: a Function used to load user objects. Expects a numeric id and a callback. The callback will be called with the result of loading the user with the specified id (either a user object or null).
2625
* done: a Function that expects an Array of user objects (as retrieved from `load`).
2726

2827
## Conditions

problems/basic_call/problem.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
JavaScript implements 'duck' typing. Duck typing is a style of dynamic typing in
2-
which an object's methods and properties determine the valid semantics,
3-
rather than its inheritance from a particular class or implementation of a
4-
specific interface. The name of the concept refers to the duck test, attributed
5-
to James Whitcomb Riley, which may be phrased as follows:
1+
JavaScript implements 'duck' typing. Duck typing is a style of dynamic typing in which an object's methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface. The name of the concept refers to the duck test, attributed to James Whitcomb Riley, which may be phrased as follows:
62

73
"When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck"
84

9-
In JavaScript, in order to write robust programs we sometimes need to
10-
check an object conforms to the type that we need.
5+
In JavaScript, in order to write robust programs we sometimes need to check an object conforms to the type that we need.
116

12-
We can use Object#hasOwnProperty to detect if an object 'has' a property defined on itself (i.e. not
13-
inherited from its prototype):
7+
We can use Object#hasOwnProperty to detect if an object 'has' a property defined on itself (i.e. not inherited from its prototype):
148

159
```js
1610
var duck = {
@@ -24,8 +18,7 @@ duck.hasOwnProperty('quack') // => true
2418

2519
We didn't give the duck a .hasOwnProperty method, where did it come from?
2620

27-
Duck was created with the `{}` syntax, and as such
28-
it inherits from Object.prototype:
21+
Duck was created with the `{}` syntax, and as such it inherits from Object.prototype:
2922

3023
```js
3124
var object = {quack: true}
@@ -50,10 +43,7 @@ object.hasOwnProperty('quack')
5043
// => TypeError: Object object has no method 'hasOwnProperty'
5144
```
5245

53-
We can still use `hasOwnProperty` from the `Object.prototype` though,
54-
if we call it with the `this` value set to something that 'looks like
55-
an object'. Function#call allows us to invoke any function with
56-
an altered `this` value.
46+
We can still use `hasOwnProperty` from the `Object.prototype` though, if we call it with the `this` value set to something that 'looks like an object'. Function#call allows us to invoke any function with an altered `this` value.
5747

5848
```js
5949
// the first argument to call becomes the value of `this`
@@ -64,9 +54,7 @@ Object.prototype.hasOwnProperty.call(object, 'quack') // => true
6454

6555
# Task:
6656

67-
Write a function `duckCount` that returns the number of arguments passed to it which
68-
have a property 'quack' defined directly on them. Do not match values inherited
69-
from prototypes.
57+
Write a function `duckCount` that returns the number of arguments passed to it which have a property 'quack' defined directly on them. Do not match values inherited from prototypes.
7058

7159
Example:
7260

@@ -77,8 +65,7 @@ duckCount(duck, notDuck) // 1
7765
```
7866
## Arguments
7967

80-
* You will be passed 0-20 arguments. Each argument could be of any type with any
81-
properties. Some of these items will have a 'quack' property.
68+
* You will be passed 0-20 arguments. Each argument could be of any type with any properties. Some of these items will have a 'quack' property.
8269

8370
## Conditions
8471

@@ -88,8 +75,7 @@ duckCount(duck, notDuck) // 1
8875

8976
## Hint
9077

91-
* The arguments variable, available in every function,
92-
is an object that quacks like an Array:
78+
* The `arguments` variable, available in every function, is an *Object* that quacks like an *Array*:
9379

9480
```js
9581
{

problems/basic_every_some/problem.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Task
22

3-
Return a function that takes a list of valid users, and returns a function that returns true
4-
if all of the supplied users exist in the original list of users.
3+
Return a function that takes a list of valid users, and returns a function that returns true if all of the supplied users exist in the original list of users.
54

65
You only need to check that the ids match.
76

@@ -35,8 +34,7 @@ testAllValid([
3534

3635
* goodUsers: a list of valid users
3736

38-
Use array#some and Array#every to check every user passed to your returned
39-
function exists in the array passed to the exported function.
37+
Use array#some and Array#every to check every user passed to your returned function exists in the array passed to the exported function.
4038

4139
## Conditions
4240

problems/basic_filter/problem.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Task
22
Use Array#filter to write a function called `getShortMessages`.
33

4-
`getShortMessages` takes an array of objects with '.message' properties
5-
and returns an array of messages that are *less than < 50 characters long*.
4+
`getShortMessages` takes an array of objects with '.message' properties and returns an array of messages that are *less than < 50 characters long*.
65

76
## Arguments
87

@@ -25,8 +24,7 @@ and returns an array of messages that are *less than < 50 characters long*.
2524

2625
## Example
2726

28-
The function should return an array containing the messages themselves,
29-
*without their containing object*.
27+
The function should return an array containing the messages themselves, *without their containing object*.
3028

3129
e.g.
3230
```

problems/basic_inheritance_with_objectcreate/problem.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Task
22

3-
Create a new "BetterUser" type that extends "User" by overriding
4-
the User's `.toString` method.
3+
Create a new "BetterUser" type that extends "User" by overriding the User's `.toString` method.
54

6-
Your exported function will be passed the constructor function
7-
for a "User" type that looks like this:
5+
Your exported function will be passed the constructor function for a "User" type that looks like this:
86

97
```js
108
/**
@@ -42,8 +40,7 @@ Note: you do not need to copy this into your solution.
4240

4341
## Example
4442

45-
From your exported function, return a `BetterUser` constructor function
46-
that extends `User` with a custom `toString` method that works like so:
43+
From your exported function, return a `BetterUser` constructor function that extends `User` with a custom `toString` method that works like so:
4744

4845
```js
4946
var joe = new BetterUser('Mr.', 'Joe Smith') // pass in title and name

problems/basic_inheritance_without_objectcreate/problem.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ Details copied below for your reference.
2323

2424
## Previous Task Definition
2525

26-
Create a "BetterUser" that extends "User" by overriding
27-
the User's `.toString` method.
26+
Create a "BetterUser" that extends "User" by overriding the User's `.toString` method.
2827

29-
Your exported function will be passed the constructor function
30-
for a "User" type that looks like this:
28+
Your exported function will be passed the constructor function for a "User" type that looks like this:
3129

3230
```js
3331
/**
@@ -65,8 +63,7 @@ Note: you do not need to copy this into your solution.
6563

6664
## Example
6765

68-
From your exported function, return a `BetterUser` constructor function
69-
that extends `User` with a custom `toString` method that works like so:
66+
From your exported function, return a `BetterUser` constructor function that extends `User` with a custom `toString` method that works like so:
7067

7168
```js
7269
var joe = new BetterUser('Mr.', 'Joe Smith') // pass in title and name

problems/basic_recursion/problem.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
Recursion is a fundamental programming concept which can lead to elegant and efficient solutions to
2-
algorithmic problems. In fact, recursion is so powerful, all iterating behaviour can be defined using
3-
recursive functions. You will find recursion indispensable when iterating over nested data structures.
1+
Recursion is a fundamental programming concept which can lead to elegant and efficient solutions to algorithmic problems. In fact, recursion is so powerful, all iterating behaviour can be defined using recursive functions. You will find recursion indispensable when iterating over nested data structures.
42

5-
A recursive function is a function which calls itself. For example, this recursive function will
6-
take an array of words, and return an array of those words, uppercased.
3+
A recursive function is a function which calls itself. For example, this recursive function will take an array of words, and return an array of those words, uppercased.
74

85
```js
96
function toUpperArray(items) {
@@ -17,27 +14,20 @@ function toUpperArray(items) {
1714
toUpperArray(['hello', 'world']) // => ['HELLO', 'WORLD']
1815
```
1916

20-
The point of this exercise is to familiarise yourself with recursion by implementing a familiar
21-
interface using a recursive function.
17+
The point of this exercise is to familiarise yourself with recursion by implementing a familiar interface using a recursive function.
2218

2319
# Task
2420

2521
Implement Array#reduce using recursion.
2622

27-
To test your reduction works correctly we will use your reduce implementation to execute our solution
28-
to the previous basic_reduce problem. i.e. your reduce function will be passed an array of words, and
29-
a function, and an initial value which will return an object containing the counts for each word found
30-
in the array. You don't need to implement this functionality, it will be supplied to your reduce
31-
implementation.
23+
To test your reduction works correctly we will use your reduce implementation to execute our solution to the previous basic_reduce problem. i.e. your reduce function will be passed an array of words, and a function, and an initial value which will return an object containing the counts for each word found in the array. You don't need to implement this functionality, it will be supplied to your reduce implementation.
3224

33-
For simplicity, your implementation of reduce **need not replicate the behaviour of a reduce missing an
34-
initial value**. You may assume the initial value will always be supplied.
25+
For simplicity, your implementation of reduce **need not replicate the behaviour of a reduce missing an initial value**. You may assume the initial value will always be supplied.
3526

3627
## Arguments
3728

3829
* arr: An Array to reduce over
39-
* fn: Function to use as the reduction step.
40-
Like regular Array#reduce, this function must be passed previousValue, currentValue, index and the array we're iterating over.
30+
* fn: Function to use as the reduction step. Like regular Array#reduce, this function must be passed previousValue, currentValue, index and the array we're iterating over.
4131
* init: Initial value of the reduction. Unlike Array#reduce, this value is required (and you may assume it will always be supplied).
4232

4333
## Example

problems/basic_reduce/problem.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Task
22

3-
Given an Array of strings, use `Array#reduce` to create an object that
4-
contains the number of times each string occured in the array. Return the
5-
object directly (no need to console.log).
3+
Given an Array of strings, use `Array#reduce` to create an object that contains the number of times each string occured in the array. Return the object directly (no need to console.log).
64

75
## Example
86

problems/blocking_event_loop/problem.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Task
22

3-
Modify the recursive `repeat` function provided in the boilerplate,
4-
such that it does not block the event loop (i.e. Timers and IO handlers can fire).
5-
This necessarily requires repeat to be asynchronous.
3+
Modify the recursive `repeat` function provided in the boilerplate, such that it does not block the event loop (i.e. Timers and IO handlers can fire). This necessarily requires repeat to be asynchronous.
64

7-
A timeout is queued to fire after 1 second, which will print the results
8-
of the test and exit the process. `repeat` should release control of the event
9-
loop such that the timeout fires before 1500 milliseconds elapse.
5+
A timeout is queued to fire after 1 second, which will print the results of the test and exit the process. `repeat` should release control of the event loop such that the timeout fires before 1500 milliseconds elapse.
106

117
Try to perform as many operations as you can before the timeout fires!
128

problems/currying/problem.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ In this challenge, we're going to implement a 'curry' function for an arbitrary
3737
`curryN` will take two parameters:
3838

3939
* fn: The function we want to curry.
40-
* n: Optional number of arguments to curry.
41-
If not supplied, `curryN` should use the fn's arity as the value for `n`.
40+
* n: Optional number of arguments to curry. If not supplied, `curryN` should use the fn's arity as the value for `n`.
4241

4342
## Example
4443

@@ -62,8 +61,7 @@ console.log(curryN(add3)(1)(2)(3)) // => 6
6261

6362
## Hint
6463

65-
* You can detect the number of expected arguments to a function (it's arity)
66-
by checking a function's .length property.
64+
* You can detect the number of expected arguments to a function (it's arity) by checking a function's .length property.
6765

6866
## Boilerplate
6967

0 commit comments

Comments
 (0)