Skip to content

Commit b57e3d0

Browse files
committed
minor update in tests, update grammar
1 parent ba1398a commit b57e3d0

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Write your JavaScript in the provided `src/functions-and-arrays.js` file.
8686

8787
Define a function `maxOfTwoNumbers` that takes two numbers as arguments and returns the largest.
8888

89-
## Iteration #2: Finding Longest Word
89+
## Iteration #2: Find longest word
9090

9191
Declare a function named `findLongestWord` that takes as an argument an array of words and returns the longest one. If there are 2 with the same length, it should return the first occurrence.
9292

@@ -96,7 +96,7 @@ Declare a function named `findLongestWord` that takes as an argument an array of
9696
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
9797
```
9898

99-
## Iteration #3: Calculating a Sum
99+
## Iteration #3: Calculate the sum
100100

101101
Calculating a sum is as simple as iterating over an array and adding each of the elements together.
102102

@@ -110,7 +110,7 @@ Declare a function named `sumArray` that takes as an argument an array of number
110110
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
111111
```
112112

113-
## Iteration #4: Calculate the Average
113+
## Iteration #4: Calculate the average
114114

115115
Calculating an average is an extremely common task. Let's practice it a bit.
116116

@@ -119,7 +119,7 @@ Calculating an average is an extremely common task. Let's practice it a bit.
119119
1. Find the sum as we did in the first exercise
120120
2. Take the sum from step 1, and divide it by the number of elements in the list.
121121

122-
### Level 1: Array of Numbers
122+
### Level 1: Array of numbers
123123

124124
Declare a function named `averageNumbers` that expects an array of numbers and returns the average of the numbers:
125125

@@ -129,7 +129,7 @@ Declare a function named `averageNumbers` that expects an array of numbers and r
129129
const numbers = [2, 6, 9, 10, 7, 4, 1, 9];
130130
```
131131

132-
### Level 2: Array of Strings
132+
### Level 2: Array of strings
133133

134134
Declare a function named `averageWordLength` that receives as a single argument an array of words and returns the average length of the words:
135135

@@ -150,7 +150,7 @@ const words = [
150150
];
151151
```
152152

153-
## Iteration #5: Unique Arrays
153+
## Iteration #5: Unique arrays
154154

155155
Take the following array, remove the duplicates, and return a new array. You're more than likely going to want to check out the [`indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf) Array method.
156156

@@ -174,7 +174,7 @@ const words = [
174174
];
175175
```
176176

177-
## Iteration #6: Finding Elements
177+
## Iteration #6: Find elements
178178

179179
Let's create a simple array search.
180180

@@ -195,7 +195,7 @@ const words = [
195195
];
196196
```
197197

198-
## Iteration #7: Counting Repetition
198+
## Iteration #7: Count repetition
199199

200200
Declare a function named `howManyTimes` that will take in an array of words as the first argument, and a word to search for as the second argument. The function will return the number of times that word appears in the array.
201201

starter-code/src/functions-and-arrays.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
// Find the maximum
1+
// Iteration #1: Find the maximum
22

3-
// Finding Longest Word
3+
// Iteration #2: Find longest word
44
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
55

6-
// Calculating a Sum
6+
// Iteration #3: Calculate the sum
77

88
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
99

10-
// Calculate the Average
11-
10+
// Iteration #4: Calculate the average
11+
// Level 1: Array of numbers
1212
const numbersAvg = [2, 6, 9, 10, 7, 4, 1, 9];
1313

14-
// Array of Strings
14+
// Level 2: Array of strings
1515
const wordsArr = [
1616
'seat',
1717
'correspond',
@@ -25,7 +25,7 @@ const wordsArr = [
2525
'palace'
2626
];
2727

28-
// Unique Arrays
28+
// Iteration #5: Unique arrays
2929
const wordsUnique = [
3030
'crab',
3131
'poison',
@@ -40,7 +40,7 @@ const wordsUnique = [
4040
'bring'
4141
];
4242

43-
// Finding Elements
43+
// Iteration #6: Find elements
4444
const wordsFind = [
4545
'machine',
4646
'subset',
@@ -52,7 +52,7 @@ const wordsFind = [
5252
'disobedience'
5353
];
5454

55-
// Counting Repetition
55+
// Iteration #7: Count repetition
5656
const wordsCount = [
5757
'machine',
5858
'matter',
@@ -67,7 +67,7 @@ const wordsCount = [
6767
'matter'
6868
];
6969

70-
// Bonus
70+
// Iteration #8: Bonus
7171

7272
const matrix = [
7373
[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],

starter-code/tests/FunctionsAndArraysSpec.js renamed to starter-code/tests/functions-and-array-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ describe("Finding Longest Word - findLongestWord", function() {
3535
expect(typeof findLongestWord).toBe("function");
3636
});
3737

38-
it("returns null with an empty array", function() {
38+
it("returns null when called with an empty array", function() {
3939
expect(findLongestWord([])).toBe(null);
4040
});
4141

42-
it("returns the word with an 1-word array", function() {
42+
it("returns the word when called with a single-word array", function() {
4343
expect(findLongestWord(["foo"])).toBe("foo");
4444
});
4545

0 commit comments

Comments
 (0)