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
Copy file name to clipboardExpand all lines: README.md
+31-33Lines changed: 31 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -50,18 +50,18 @@ We have already included Jasmine in the project you just forked, so let's see ho
50
50
Before start coding, we will explain the project structure we have provided you:
51
51
52
52
```
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
62
62
```
63
63
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.
65
65
66
66
#### Run tests
67
67
@@ -79,15 +79,13 @@ When coding with tests, it is super important that you carefully read and unders
79
79
80
80
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.
81
81
82
-
## Deliverables
82
+
## Instructions
83
83
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
87
85
88
86
Define a function `maxOfTwoNumbers` that takes two numbers as arguments and returns the largest.
89
87
90
-
## Iteration #2: Find the longest word
88
+
###Iteration #2: Find the longest word
91
89
92
90
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.
93
91
@@ -97,7 +95,7 @@ You can use the following array to test your solution:
### Bonus - Iteration #4.1: A generic `avg()` function
157
+
####Bonus - Iteration #4.1: A generic `avg()` function
160
158
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:
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.
172
170
173
171
Do this in the form of a function `uniquifyArray` that receives an array of words as a argument.
174
172
175
-
**Starter code**
173
+
You can use the following array to test your solution:
176
174
177
175
```javascript
178
176
constwords= [
@@ -190,23 +188,23 @@ const words = [
190
188
];
191
189
```
192
190
193
-
## Iteration #6: Find elements
191
+
###Iteration #6: Find elements
194
192
195
193
Let's create a simple array search.
196
194
197
195
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.
198
196
199
-
**Starter code**
197
+
You can use the following array to test your solution:
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.
208
206
209
-
**Starter code**
207
+
You can use the following array to test your solution:
210
208
211
209
```javascript
212
210
constwords= [
@@ -224,7 +222,7 @@ const words = [
224
222
];
225
223
```
226
224
227
-
## Bonus - Iteration #8: Product of adjacent numbers
225
+
###Bonus - Iteration #8: Product of adjacent numbers
228
226
229
227
What is the greatest product of four adjacent numbers? We consider adjacent any four numbers that are next to each other horizontally or vertically.
230
228
@@ -238,7 +236,7 @@ For example, if we have a 5x5 Matrix like:
238
236
[ 1, 4, 3, 4, 5]
239
237
```
240
238
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`.
242
240
243
241
Declare a function named `greatestProduct(matrix)` to find it in the 20×20 grid below!
244
242
@@ -267,7 +265,7 @@ const matrix = [
267
265
];
268
266
```
269
267
270
-
## Bonus - Iteration #8.1: Product of diagonals
268
+
###Bonus - Iteration #8.1: Product of diagonals
271
269
272
270
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.
0 commit comments