From 003dc0b7969abda5e9810f3f8b5158b6113f838d Mon Sep 17 00:00:00 2001 From: Axel Garcia Date: Fri, 15 Feb 2019 10:57:41 +0100 Subject: [PATCH 1/2] bcn --- README.md | 25 +++++++++--------- .../SpecRunner.html => SpecRunner.html | 0 .../jasmine => jasmine}/jasmine-2.8.0/boot.js | 0 .../jasmine-2.8.0/console.js | 0 .../jasmine-2.8.0/ironhack.png | Bin .../jasmine-2.8.0/jasmine-html.js | 0 .../jasmine-2.8.0/jasmine.css | 0 .../jasmine-2.8.0/jasmine.js | 0 .../jasmine-2.8.0/jasmine_favicon.png | Bin .../src => src}/functions-and-arrays.js | 0 .../tests => tests}/FunctionsAndArraysSpec.js | 0 11 files changed, 13 insertions(+), 12 deletions(-) rename starter-code/SpecRunner.html => SpecRunner.html (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/boot.js (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/console.js (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/ironhack.png (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/jasmine-html.js (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/jasmine.css (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/jasmine.js (100%) rename {starter-code/jasmine => jasmine}/jasmine-2.8.0/jasmine_favicon.png (100%) rename {starter-code/src => src}/functions-and-arrays.js (100%) rename {starter-code/tests => tests}/FunctionsAndArraysSpec.js (100%) diff --git a/README.md b/README.md index 81bf62d26..b2a49416e 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ We have already included Jasmine in the project you just forked, so let's see ho Before start coding, we will explain the project structure we have provided you: ``` -starter-code/ ├── jasmine │   ├── jasmine-2.8.0/ │   | └── ... @@ -87,11 +86,13 @@ When coding with tests, is super important to read and understand the errors we All our work will be located in the `functions-and-arrays.js` file, so that will be enough. Anyway, you have to `push` the whole repo to Github. -## Find the maximum +You don't need to call the functions, the test will do that for you! + +## Iteration 1: Find the maximum Define a function `maxOfTwoNumbers` that takes two numbers as arguments and returns the largest. -## Finding Longest Word +## Iteration 2: Finding Longest Word Write a function `findLongestWord` that takes an array of words and returns the longest one. If there are 2 with the same length, it should return the first occurrence. @@ -109,12 +110,10 @@ var words = [ ]; ``` -## Calculating a Sum +## Iteration 3: Calculating a Sum Calculating a sum is as simple as iterating over an array and adding each of the elements together. -Semantically [reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce) is the best method to use for this, but you can use any loop we've discussed so far. - Create a `sumArray` function that takes an array of numbers as a parameter, and calculate the sum of all its numbers: **Starter Code** @@ -123,7 +122,7 @@ Create a `sumArray` function that takes an array of numbers as a parameter, and var numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10]; ``` -## Calculate the Average +## Iteration 4: Calculate the Average Calculating an average is an extremely common task. Let's practice it a bit. @@ -132,7 +131,7 @@ Calculating an average is an extremely common task. Let's practice it a bit. 1. Find the sum as we did in the first exercise 2. Take the sum from step 1, and divide it by the number of elements in the list. -### Level 1: Array of Numbers +### Iteration 5: Level 1: Array of Numbers Write a function `averageNumbers` that receives an array of numbers and calculate the average of the numbers: @@ -142,7 +141,7 @@ Write a function `averageNumbers` that receives an array of numbers and calculat var numbers = [2, 6, 9, 10, 7, 4, 1, 9]; ``` -### Level 2: Array of Strings +### Iteration 6: Level 2: Array of Strings Write a function `averageWordLength` that receives an array of words and calculate the average length of the words: @@ -163,7 +162,7 @@ var words = [ ]; ``` -## Unique Arrays +## Iteration 7: Unique Arrays 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) function. @@ -188,7 +187,7 @@ var words = [ ``` -## Finding Elements +## Iteration 8: Finding Elements Let's create a simple array search. @@ -208,7 +207,7 @@ var words = [ ]; ``` -## Counting Repetion +## Iteration 9: Counting Repetion Write a function `howManyTimes` that will take in an array of words as one argument, and a word to search for as the other. The function will return the number of times that word appears in the array. @@ -232,6 +231,8 @@ var words = [ ## Bonus Quest +Don't focuse on the test for this exercise. It's just to help you beggin. + In the 20×20 grid below; What is the greatest product of four adjacent numbers in the same direction (up, down, left, right)? Write a function `greatestProduct` to find the answer! diff --git a/starter-code/SpecRunner.html b/SpecRunner.html similarity index 100% rename from starter-code/SpecRunner.html rename to SpecRunner.html diff --git a/starter-code/jasmine/jasmine-2.8.0/boot.js b/jasmine/jasmine-2.8.0/boot.js similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/boot.js rename to jasmine/jasmine-2.8.0/boot.js diff --git a/starter-code/jasmine/jasmine-2.8.0/console.js b/jasmine/jasmine-2.8.0/console.js similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/console.js rename to jasmine/jasmine-2.8.0/console.js diff --git a/starter-code/jasmine/jasmine-2.8.0/ironhack.png b/jasmine/jasmine-2.8.0/ironhack.png similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/ironhack.png rename to jasmine/jasmine-2.8.0/ironhack.png diff --git a/starter-code/jasmine/jasmine-2.8.0/jasmine-html.js b/jasmine/jasmine-2.8.0/jasmine-html.js similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/jasmine-html.js rename to jasmine/jasmine-2.8.0/jasmine-html.js diff --git a/starter-code/jasmine/jasmine-2.8.0/jasmine.css b/jasmine/jasmine-2.8.0/jasmine.css similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/jasmine.css rename to jasmine/jasmine-2.8.0/jasmine.css diff --git a/starter-code/jasmine/jasmine-2.8.0/jasmine.js b/jasmine/jasmine-2.8.0/jasmine.js similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/jasmine.js rename to jasmine/jasmine-2.8.0/jasmine.js diff --git a/starter-code/jasmine/jasmine-2.8.0/jasmine_favicon.png b/jasmine/jasmine-2.8.0/jasmine_favicon.png similarity index 100% rename from starter-code/jasmine/jasmine-2.8.0/jasmine_favicon.png rename to jasmine/jasmine-2.8.0/jasmine_favicon.png diff --git a/starter-code/src/functions-and-arrays.js b/src/functions-and-arrays.js similarity index 100% rename from starter-code/src/functions-and-arrays.js rename to src/functions-and-arrays.js diff --git a/starter-code/tests/FunctionsAndArraysSpec.js b/tests/FunctionsAndArraysSpec.js similarity index 100% rename from starter-code/tests/FunctionsAndArraysSpec.js rename to tests/FunctionsAndArraysSpec.js From c96ca7214bd447bbb5ef49fc781cd782a508ac84 Mon Sep 17 00:00:00 2001 From: Axel Garcia Date: Fri, 15 Feb 2019 10:59:29 +0100 Subject: [PATCH 2/2] modify readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b2a49416e..d8e461ab4 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ Calculating an average is an extremely common task. Let's practice it a bit. 1. Find the sum as we did in the first exercise 2. Take the sum from step 1, and divide it by the number of elements in the list. -### Iteration 5: Level 1: Array of Numbers +### Level 1: Array of Numbers Write a function `averageNumbers` that receives an array of numbers and calculate the average of the numbers: @@ -141,7 +141,7 @@ Write a function `averageNumbers` that receives an array of numbers and calculat var numbers = [2, 6, 9, 10, 7, 4, 1, 9]; ``` -### Iteration 6: Level 2: Array of Strings +### Level 2: Array of Strings Write a function `averageWordLength` that receives an array of words and calculate the average length of the words: @@ -162,7 +162,7 @@ var words = [ ]; ``` -## Iteration 7: Unique Arrays +## Iteration 5: Unique Arrays 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) function. @@ -187,7 +187,7 @@ var words = [ ``` -## Iteration 8: Finding Elements +## Iteration 6: Finding Elements Let's create a simple array search. @@ -207,7 +207,7 @@ var words = [ ]; ``` -## Iteration 9: Counting Repetion +## Iteration 7: Counting Repetion Write a function `howManyTimes` that will take in an array of words as one argument, and a word to search for as the other. The function will return the number of times that word appears in the array.