Skip to content

Commit 9698428

Browse files
committed
remove starter code, update readme
1 parent a637cc6 commit 9698428

11 files changed

+31
-33
lines changed

README.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ We have already included Jasmine in the project you just forked, so let's see ho
5050
Before start coding, we will explain the project structure we have provided you:
5151

5252
```
53-
starter-code/
54-
├── jasmine
55-
│   ├── jasmine-2.8.0/
56-
│   | └── ...
57-
── src
58-
│   └── functions-and-arrays.js
59-
── tests
60-
│   └── functions-and-arrays.spec.js
61-
└─ SpecRunner.html
53+
lab-js-functions-and-arrays
54+
├── README.md
55+
├── SpecRunner.html
56+
── jasmine
57+
│   └── ...
58+
── src
59+
│   └── functions-and-arrays.js
60+
└── tests
61+
└── functions-and-arrays.spec.js
6262
```
6363

64-
We will be working with the `functions-and-arrays.js` file inside of the `src` folder. In the `jasmine` folder you can find all of the files that compose Jasmine, that is already linked with the `SpecRunner.html` file.
64+
We will be working with the `src/functions-and-arrays.js`. In the `jasmine` folder you can find all of the files needed to use Jasmine. All these files are already linked with the `SpecRunner.html` file.
6565

6666
#### Run tests
6767

@@ -79,15 +79,13 @@ When coding with tests, it is super important that you carefully read and unders
7979

8080
Note that **you don't need to execute the functions yourself**, the tests are responsible for doing that. All you should do is declare them, make sure they deal with the parameters passed and that they return what is indicated on the iterations and in the test messages. For some iterations we provide you with a sample array, so that you can do some **manual** testing, if you wish.
8181

82-
## Deliverables
82+
## Instructions
8383

84-
Write your JavaScript in the provided `src/functions-and-arrays.js` file.
85-
86-
## Iteration #1: Find the maximum
84+
### Iteration #1: Find the maximum
8785

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

90-
## Iteration #2: Find the longest word
88+
### Iteration #2: Find the longest word
9189

9290
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.
9391

@@ -97,7 +95,7 @@ You can use the following array to test your solution:
9795
const words = ['mystery', 'brother', 'aviator', 'crocodile', 'pearl', 'orchard', 'crackpot'];
9896
```
9997

100-
## Iteration #3: Calculate the sum
98+
### Iteration #3: Calculate the sum
10199

102100
Calculating a sum can be as simple as iterating over an array and adding each of the elements together.
103101

@@ -109,7 +107,7 @@ You can use the following array to test your solution:
109107
const numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
110108
```
111109

112-
### Bonus - Iteration #3.1: A generic `sum()` function
110+
#### Bonus - Iteration #3.1: A generic `sum()` function
113111

114112
**The goal: Learn how to refactor your code.** :muscle:
115113

@@ -127,7 +125,7 @@ const mixedArr = [6, 12, 'miami', 1, true, 'barca', '200', 'lisboa', 8, 10];
127125
// should return: 57
128126
```
129127

130-
## Iteration #4: Calculate the average
128+
### Iteration #4: Calculate the average
131129

132130
Calculating an average is an extremely common task. Let's practice it a bit.
133131

@@ -136,43 +134,43 @@ Calculating an average is an extremely common task. Let's practice it a bit.
136134
1. Find the sum as we did in the first exercise (or how about reusing that the _sumNumbers()_?)
137135
2. Take that sum and divide it by the number of elements in the list.
138136

139-
### Level 1: Array of numbers
137+
#### Level 1: Array of numbers
140138

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

143-
**Starter code**
141+
You can use the following array to test your solution:
144142

145143
```javascript
146144
const numbers = [2, 6, 9, 10, 7, 4, 1, 9];
147145
```
148146

149-
### Level 2: Array of strings
147+
#### Level 2: Array of strings
150148

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

153-
**Starter code**
151+
You can use the following array to test your solution:
154152

155153
```javascript
156154
const words = ['seat', 'correspond', 'linen', 'motif', 'hole', 'smell', 'smart', 'chaos', 'fuel', 'palace'];
157155
```
158156

159-
### Bonus - Iteration #4.1: A generic `avg()` function
157+
#### Bonus - Iteration #4.1: A generic `avg()` function
160158

161-
Create function `avg(arr)` that receives any mixed array and calculates average. Consider as mixed array an array filled with numbers and/or strings and/or booleans. We are following a similar logic to the one applied on the bonus iteration 4.1 :wink:
159+
Create function `avg(arr)` that receives any mixed array and calculates average. Consider as mixed array an array filled with numbers and/or strings and/or booleans. We are following a similar logic to the one applied on the bonus iteration 4.1. :wink:
162160

163161
```javascript
164162
const mixedArr = [6, 12, 'miami', 1, true, 'barca', '200', 'lisboa', 8, 10];
165163

166164
// should return: 5.7
167165
```
168166

169-
## Iteration #5: Unique arrays
167+
### Iteration #5: Unique arrays
170168

171169
Take the following array, remove the duplicates, and return a new array. You are 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.
172170

173171
Do this in the form of a function `uniquifyArray` that receives an array of words as a argument.
174172

175-
**Starter code**
173+
You can use the following array to test your solution:
176174

177175
```javascript
178176
const words = [
@@ -190,23 +188,23 @@ const words = [
190188
];
191189
```
192190

193-
## Iteration #6: Find elements
191+
### Iteration #6: Find elements
194192

195193
Let's create a simple array search.
196194

197195
Declare a function named `doesWordExist` that will take in an array of words as one argument, and a word to search for as the other. Return `true` if it exists, otherwise, return `false`. **Don't** use `indexOf` for this one.
198196

199-
**Starter code**
197+
You can use the following array to test your solution:
200198

201199
```javascript
202200
const words = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];
203201
```
204202

205-
## Iteration #7: Count repetition
203+
### Iteration #7: Count repetition
206204

207205
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.
208206

209-
**Starter code**
207+
You can use the following array to test your solution:
210208

211209
```javascript
212210
const words = [
@@ -224,7 +222,7 @@ const words = [
224222
];
225223
```
226224

227-
## Bonus - Iteration #8: Product of adjacent numbers
225+
### Bonus - Iteration #8: Product of adjacent numbers
228226

229227
What is the greatest product of four adjacent numbers? We consider adjacent any four numbers that are next to each other horizontally or vertically.
230228

@@ -238,7 +236,7 @@ For example, if we have a 5x5 Matrix like:
238236
[ 1, 4, 3, 4, 5]
239237
```
240238

241-
The greatest product will be the `20`x`20`x`20`x`4` = `32000`;
239+
The greatest product will be the `20`x`20`x`20`x`4` = `32000`.
242240

243241
Declare a function named `greatestProduct(matrix)` to find it in the 20×20 grid below!
244242

@@ -267,7 +265,7 @@ const matrix = [
267265
];
268266
```
269267

270-
## Bonus - Iteration #8.1: Product of diagonals
268+
### Bonus - Iteration #8.1: Product of diagonals
271269

272270
Following the logic you've used in iteration #8, declare a function called `greatestProductOfDiagonals(matrix)`. It takes a matrix as a parameter and returns the greatest product of any four values layed out diagonally, in either direction.
273271

File renamed without changes.

0 commit comments

Comments
 (0)