From e71e483553674a3122471b88a4478f7b4b24a134 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:18:10 -0400 Subject: [PATCH 01/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 82cd3b0..423e637 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -15,17 +15,22 @@ var searchArray = function(array,value) { }; ``` -#### Exercises 2: Determine whether a given string is a [palindrome](https://en.wikipedia.org/wiki/Palindrome) -- Write a function `isPalindrome` that takes in a single parameter `str`, a string, and returns `true` if the string is a palindrome, and false otherwise. For example +#### Exercises 2: [Permutation](https://en.wikipedia.org/wiki/Permutation) + +- Given two strings, write a method to decide if one is a permutation of the other + +Note: If you were given this problem in an inteview, important things to ask your interviewer would be: +Is this case sensitive (ex: is `God` different from `dog`)? +Is whitespace significant? (for this question, the white space is not important) ```javascript -isPalindrome('hello') => false -isPalindrome('hannah') => true +- isPermutation('cat top', 'tap pat`) => false +- isPermutation('cat top', `tot cap`) => true ``` Here is some starter code: ```javascript -var isPalindrome = function(str) { +var isPermutation = function(str1, str2) { }; ``` From 2e1ec43d4112e7e06f29a91ead5f9259eded0bbb Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:47:30 -0400 Subject: [PATCH 02/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 423e637..cb7d679 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -1,5 +1,5 @@ # W02D02 Morning Warmup -![Image of Caveman](http://s3.amazonaws.com/media.wbur.org/wordpress/11/files/2011/10/1017_palindrome.jpg) +![Cat Programmer](https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&ved=0ahUKEwi5oKTs7fDMAhXHHT4KHVFEBlEQjRwIBw&url=http%3A%2F%2Fwww.troll.me%2Fmeme%2Fcomputer-expert-cat&bvm=bv.122676328,d.cWw&psig=AFQjCNFOpkl1dcFGsTlMbhFN7bRnfaZdcQ&ust=1464115591294236) ####Exercises 1: Find a value in a given array - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. From 2aa04bd134658f5f71180284789e29f3f853c75d Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:48:04 -0400 Subject: [PATCH 03/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index cb7d679..5d9ef81 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -1,5 +1,5 @@ # W02D02 Morning Warmup -![Cat Programmer](https://www.google.com/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&ved=0ahUKEwi5oKTs7fDMAhXHHT4KHVFEBlEQjRwIBw&url=http%3A%2F%2Fwww.troll.me%2Fmeme%2Fcomputer-expert-cat&bvm=bv.122676328,d.cWw&psig=AFQjCNFOpkl1dcFGsTlMbhFN7bRnfaZdcQ&ust=1464115591294236) +![Cat Programmer](http://www.troll.me/images/computer-expert-cat/computer-expert-cat.jpg) ####Exercises 1: Find a value in a given array - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. From 712566c7d73bd3a80aacde5c769ba25be337993f Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:48:41 -0400 Subject: [PATCH 04/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 5d9ef81..57e49af 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -1,5 +1,5 @@ # W02D02 Morning Warmup -![Cat Programmer](http://www.troll.me/images/computer-expert-cat/computer-expert-cat.jpg) +![Cat Programmer](http://www.troll.me/images/computer-expert-cat/computer-expert-cat-iz-bizzy-makin-memes-thumb.jpg) ####Exercises 1: Find a value in a given array - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. From 42d37b5aabfe2eb20e96445fba86d6c3ff4c598f Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:49:18 -0400 Subject: [PATCH 05/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 57e49af..21d1939 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -1,5 +1,5 @@ # W02D02 Morning Warmup -![Cat Programmer](http://www.troll.me/images/computer-expert-cat/computer-expert-cat-iz-bizzy-makin-memes-thumb.jpg) +![Cat Programmer](http://s2.quickmeme.com/img/99/9903c7c14add3fd0758b7b5b80c24d48101f296f13ce34736799a82c71f61bc2.jpg) ####Exercises 1: Find a value in a given array - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. From 674976c6755daa763794941308841c07f2b0dd03 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:50:17 -0400 Subject: [PATCH 06/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 21d1939..65d1b6e 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -21,12 +21,12 @@ var searchArray = function(array,value) { - Given two strings, write a method to decide if one is a permutation of the other Note: If you were given this problem in an inteview, important things to ask your interviewer would be: -Is this case sensitive (ex: is `God` different from `dog`)? -Is whitespace significant? (for this question, the white space is not important) +- Is this case sensitive (ex: is `God` different from `dog`)? +- Is whitespace significant? (for this question, the white space is not important) ```javascript -- isPermutation('cat top', 'tap pat`) => false -- isPermutation('cat top', `tot cap`) => true +isPermutation('cat top', 'tap pat`) => false +isPermutation('cat top', `tot cap`) => true ``` Here is some starter code: ```javascript From 1803f2cb92bfc0cdfdad7937ed082bc530b803ee Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 14:51:02 -0400 Subject: [PATCH 07/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 65d1b6e..9c87011 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -25,8 +25,8 @@ Note: If you were given this problem in an inteview, important things to ask you - Is whitespace significant? (for this question, the white space is not important) ```javascript -isPermutation('cat top', 'tap pat`) => false -isPermutation('cat top', `tot cap`) => true +isPermutation(`cat top`, `tap pat`) => false +isPermutation(`cat top`, `tot cap`) => true ``` Here is some starter code: ```javascript From d2480d8033040fb826514e15867653b64908a00b Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:44:00 -0400 Subject: [PATCH 08/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 144 +++++++++++++++++++--- 1 file changed, 126 insertions(+), 18 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index 9c87011..ff7bf2a 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -1,36 +1,144 @@ # W02D02 Morning Warmup + ![Cat Programmer](http://s2.quickmeme.com/img/99/9903c7c14add3fd0758b7b5b80c24d48101f296f13ce34736799a82c71f61bc2.jpg) -####Exercises 1: Find a value in a given array - - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. -```javascript -var nums = [1,2,3,4,5] -searchArray(nums, 3) => true -searchArray(nums, 6) => -1 + + +# JAVASCRIPT ITERATORS + +#####`.forEach`, `.map`, and `.reduce` + +Javascript iterators are like loops. They step (or iterate) over each item in an array. Iterators perform operations according to conditions specified in a callback. + +# .forEach + +`.forEach` is the basic iterator, all it does is step through each item in an array. + +#### EXAMPLE: + ``` -Here is some starter code: -```javascript -var searchArray = function(array,value) { +arr = [8, 8, 8, 8, 8, 8, 8, 8]; + +arr.forEach(function(n) { + console.log(n + 1); +}); + +=> Prints a bunch of 9s to the console + +``` + + +##### EXERCISE: +- Log each word in `words` in upper case using `.forEach.` -}; ``` +words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"]; +``` + + + + +# .map +`.map` is like `.forEach` but it returns a new array with the selections and / or transformations applied in the iterator. `.map` saves to a new array and does not alter the original array. -#### Exercises 2: [Permutation](https://en.wikipedia.org/wiki/Permutation) -- Given two strings, write a method to decide if one is a permutation of the other +EXAMPLE: + +``` +var new_arr = arr.map(function(n) { + return n += n / 2 +}); + +=> [12, 12, 12, 12, 12, 12, 12, 12] +``` + +####EXERCISE: + +``` +more_words = ["Joe", "Overreats", "Eggs"]; +``` + +- Map to a new array that stores only the first letter from each word in `more_words`. -Note: If you were given this problem in an inteview, important things to ask your interviewer would be: -- Is this case sensitive (ex: is `God` different from `dog`)? -- Is whitespace significant? (for this question, the white space is not important) +Expected result: +``` +["J", "O", "E"] +``` + +... + +# .reduce + +`.reduce` iterates over the elements in an array and smooshes them together into a single variable according to the instructions in the iterator. Like `.map`, it returns a new value and does not alter the original array. + +#### EXAMPLE: + +Add together all numbers in an array: + +``` +new_value = arr.reduce(function(sum, n){ + return sum += n +}); + +=> 64 +``` + + +#### EXERCISE: +``` +arr = [8, 8, 8, 8, 8, 8, 8, 8]; +``` + +- Return the product of the numbers in `arr`. + + + +... + +#### EXERCISE: + +Using both `.map` and `.reduce`, find the total sheepCount of sheep shorn by sheep shearers at the 1623 Sheep Shearing Feast: + +``` +var sheepShearers = [ + { + name: "Tim", + age: 20, + sheepCount: 18 + }, + { + name: "C3PO", + age: 200, + sheepCount: 320 + }, + { + name: "Cousin It", + age: Infinity, + sheepCount: 2900 + } +]; +``` + +``` +=> 3238 +``` + + + + + +#### EXTRA TIME: Find a value in a given array + - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. ```javascript -isPermutation(`cat top`, `tap pat`) => false -isPermutation(`cat top`, `tot cap`) => true +var nums = [1,2,3,4,5] +searchArray(nums, 3) => true +searchArray(nums, 6) => -1 ``` Here is some starter code: ```javascript -var isPermutation = function(str1, str2) { +var searchArray = function(array,value) { }; ``` From 66f26d754b26a727f117e83f0164d9b5be3fd2ac Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:44:49 -0400 Subject: [PATCH 09/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index ff7bf2a..ebfd50a 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -129,7 +129,8 @@ var sheepShearers = [ -#### EXTRA TIME: Find a value in a given array +#### FINISHED EARLY?: +Find a value in a given array - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. ```javascript var nums = [1,2,3,4,5] From e62539511acff63a158e7a5ce2c8625cb77ae76d Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:47:32 -0400 Subject: [PATCH 10/29] Create Solutions_w02d02_morning_exercise --- .../Solutions_w02d02_morning_exercise | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise new file mode 100644 index 0000000..9c60de9 --- /dev/null +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise @@ -0,0 +1,161 @@ +# W02D02 Morning Warmup + +![Cat Programmer](http://s2.quickmeme.com/img/99/9903c7c14add3fd0758b7b5b80c24d48101f296f13ce34736799a82c71f61bc2.jpg) + + + +# JAVASCRIPT ITERATORS + +#####`.forEach`, `.map`, and `.reduce` + +Javascript iterators are like loops. They step (or iterate) over each item in an array. Iterators perform operations according to conditions specified in a callback. + +# .forEach + +`.forEach` is the basic iterator, all it does is step through each item in an array. + +#### EXAMPLE: + +``` +arr = [8, 8, 8, 8, 8, 8, 8, 8]; + +arr.forEach(function(n) { + console.log(n + 1); +}); + +=> Prints a bunch of 9s to the console + +``` + + +##### EXERCISE: +- Log each word in `words` in upper case using `.forEach.` + +``` +words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"]; +``` + + + + +# .map + +`.map` is like `.forEach` but it returns a new array with the selections and / or transformations applied in the iterator. `.map` saves to a new array and does not alter the original array. + + +EXAMPLE: + +``` +var new_arr = arr.map(function(n) { + return n += n / 2 +}); + +=> [12, 12, 12, 12, 12, 12, 12, 12] +``` + +####EXERCISE: + +``` +more_words = ["Joe", "Overreats", "Eggs"]; +``` + +- Map to a new array that stores only the first letter from each word in `more_words`. + +Expected result: + +``` +["J", "O", "E"] +``` + +... + +# .reduce + +`.reduce` iterates over the elements in an array and smooshes them together into a single variable according to the instructions in the iterator. Like `.map`, it returns a new value and does not alter the original array. + +#### EXAMPLE: + +Add together all numbers in an array: + +``` +new_value = arr.reduce(function(sum, n){ + return sum += n +}); + +=> 64 +``` + + +#### EXERCISE: +``` +arr = [8, 8, 8, 8, 8, 8, 8, 8]; +``` + +- Return the product of the numbers in `arr`. + + + +... + +#### EXERCISE: + +Using both `.map` and `.reduce`, find the total sheepCount of sheep shorn by sheep shearers at the 1623 Sheep Shearing Feast: + +``` +var sheepShearers = [ + { + name: "Tim", + age: 20, + sheepCount: 18 + }, + { + name: "C3PO", + age: 200, + sheepCount: 320 + }, + { + name: "Cousin It", + age: Infinity, + sheepCount: 2900 + } +]; +``` + +``` +=> 3238 +``` + + + + + +#### FINISHED EARLY?: +Find a value in a given array + - Write a function `searchArray` that takes an array and value as parameters and searches the array for the given value. If the value is in the array, return `true`, otherwise return '-1'. +```javascript +var nums = [1,2,3,4,5] +searchArray(nums, 3) => true +searchArray(nums, 6) => -1 +``` +Here is some starter code: +```javascript +var searchArray = function(array,value) { + +}; +``` + +/////////////////////////////////////////// +SOLUTION 1 +``` +var searchArray = function(array,value) { + console.log("you're inside the function"); + + for (i=0; i < array.length; i++) { + if (value === array[i]){ + return true; + }; + }; + return '-1'; +}; + +searchArray([1,2,3,4], 5); From 9213c757431414016d47d69649631f9eeee929cc Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:49:12 -0400 Subject: [PATCH 11/29] Update Solutions_w02d02_morning_exercise --- .../Solutions_w02d02_morning_exercise | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise index 9c60de9..8df6b6a 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise @@ -125,8 +125,39 @@ var sheepShearers = [ => 3238 ``` +/////////////////////////// +SOLUTION: sheepShearer +var sheepShearers = [ + { + name: "Tim", + age: 20, + sheepCount: 18 + }, + { + name: "C3PO", + age: 200, + sheepCount: 320 + }, + { + name: "Cousin It", + age: Infinity, + sheepCount: 2900 + } +]; + + +var total = sheepShearers + .map(function(item) { + return item.sheepCount; + }) + .reduce(function(sum, num) { + return sum += num; + }); + +console.log(total); + #### FINISHED EARLY?: From ba18b03b510ce90cf931e5bad9204a0d4fd4703a Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:49:29 -0400 Subject: [PATCH 12/29] Rename Solutions_w02d02_morning_exercise to Solutions_w02d02_morning_exercise.md --- ...2d02_morning_exercise => Solutions_w02d02_morning_exercise.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename unit_01/w02d02/morning_exercise/{Solutions_w02d02_morning_exercise => Solutions_w02d02_morning_exercise.md} (100%) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md similarity index 100% rename from unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise rename to unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md From 740b26a07d61c10433077de19921582263f77296 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:55:47 -0400 Subject: [PATCH 13/29] Update Solutions_w02d02_morning_exercise.md --- .../Solutions_w02d02_morning_exercise.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md index 8df6b6a..c5d1748 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md @@ -1,9 +1,5 @@ # W02D02 Morning Warmup -![Cat Programmer](http://s2.quickmeme.com/img/99/9903c7c14add3fd0758b7b5b80c24d48101f296f13ce34736799a82c71f61bc2.jpg) - - - # JAVASCRIPT ITERATORS #####`.forEach`, `.map`, and `.reduce` @@ -26,7 +22,16 @@ arr.forEach(function(n) { => Prints a bunch of 9s to the console ``` +
+SOLUTION to .forEach + +```javascript +words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"]; +words.forEach(function (e){ + console.log(e.toUpperCase()); +}); +``` ##### EXERCISE: - Log each word in `words` in upper case using `.forEach.` From 7efe896e12600153a1a7be1e68d0bc84586a053f Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:56:33 -0400 Subject: [PATCH 14/29] Update Solutions_w02d02_morning_exercise.md --- .../Solutions_w02d02_morning_exercise.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md index c5d1748..5ee6837 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md @@ -22,15 +22,6 @@ arr.forEach(function(n) { => Prints a bunch of 9s to the console ``` -
-SOLUTION to .forEach - -```javascript -words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"]; - -words.forEach(function (e){ - console.log(e.toUpperCase()); -}); ``` ##### EXERCISE: @@ -40,7 +31,15 @@ words.forEach(function (e){ words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"]; ``` +
+SOLUTION to .forEach + +```javascript +words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nokor"]; +words.forEach(function (e){ + console.log(e.toUpperCase()); +}); # .map From 7ecf469b3b725e8d6e27eb20711ebeedb408f0c6 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 15:57:25 -0400 Subject: [PATCH 15/29] Update Solutions_w02d02_morning_exercise.md --- .../morning_exercise/Solutions_w02d02_morning_exercise.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md index 5ee6837..a4b843a 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md @@ -21,7 +21,6 @@ arr.forEach(function(n) { => Prints a bunch of 9s to the console -``` ``` ##### EXERCISE: @@ -40,7 +39,7 @@ words = ["Ho", "Chi", "Minh", "City", "was", "once", "known", "as", "Prey", "Nok words.forEach(function (e){ console.log(e.toUpperCase()); }); - +``` # .map From be7916569d4b14e828d16e1c3bd3d2de5730ff07 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 16:14:23 -0400 Subject: [PATCH 16/29] Update Solutions_w02d02_morning_exercise.md --- .../Solutions_w02d02_morning_exercise.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md index a4b843a..3fd0947 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md @@ -69,6 +69,17 @@ Expected result: ``` ["J", "O", "E"] ``` +SOLUTION: .map +```javascript +more_words = ["Joe", "Overreats", "Eggs"]; + + +var new_arr = more_words.map(function (i){ + return i.charAt(0); +}); + +console.log (new_arr); +``` ... From a2ac4ab156695205eac73397e1fcc4eb2f79f265 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 16:56:49 -0400 Subject: [PATCH 17/29] Update README.md --- unit_01/w02d02/morning_exercise/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unit_01/w02d02/morning_exercise/README.md b/unit_01/w02d02/morning_exercise/README.md index ebfd50a..303599c 100644 --- a/unit_01/w02d02/morning_exercise/README.md +++ b/unit_01/w02d02/morning_exercise/README.md @@ -78,6 +78,8 @@ Expected result: Add together all numbers in an array: ``` +arr = [8, 8, 8, 8, 8, 8, 8, 8]; + new_value = arr.reduce(function(sum, n){ return sum += n }); @@ -91,7 +93,7 @@ new_value = arr.reduce(function(sum, n){ arr = [8, 8, 8, 8, 8, 8, 8, 8]; ``` -- Return the product of the numbers in `arr`. +- Return the *product* of the numbers in `arr`. From 7272245b62242b1cfa801cef418a921c66eb8ac6 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 16:58:27 -0400 Subject: [PATCH 18/29] Update Solutions_w02d02_morning_exercise.md --- .../Solutions_w02d02_morning_exercise.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md index 3fd0947..7b263b1 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md @@ -107,7 +107,16 @@ arr = [8, 8, 8, 8, 8, 8, 8, 8]; - Return the product of the numbers in `arr`. +SOLUTION .reduce +```javascript +arr = [8, 8, 8, 8, 8, 8, 8, 8]; +new_value = arr.reduce(function(product, n){ + return product *= n +}); + +console.log(new_value); +``` ... From 846805d14fa27494d900b3480bccba46c9c5c959 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 16:59:33 -0400 Subject: [PATCH 19/29] Update Solutions_w02d02_morning_exercise.md --- .../morning_exercise/Solutions_w02d02_morning_exercise.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md index 7b263b1..f3d85e4 100644 --- a/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md +++ b/unit_01/w02d02/morning_exercise/Solutions_w02d02_morning_exercise.md @@ -151,7 +151,7 @@ var sheepShearers = [ /////////////////////////// SOLUTION: sheepShearer - +```javascript var sheepShearers = [ { name: "Tim", @@ -180,7 +180,7 @@ var total = sheepShearers }); console.log(total); - +``` #### FINISHED EARLY?: From 89650153a37cfe5fdbc89e3e4b7e96ae9cb3bb8b Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 17:07:05 -0400 Subject: [PATCH 20/29] homework w02d02 --- unit_01/w02d02/homework/CSS_Mockups/README.md | 55 +++++++++++++++++++ unit_01/w02d02/homework/README.md | 55 ------------------- 2 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 unit_01/w02d02/homework/CSS_Mockups/README.md diff --git a/unit_01/w02d02/homework/CSS_Mockups/README.md b/unit_01/w02d02/homework/CSS_Mockups/README.md new file mode 100644 index 0000000..4108698 --- /dev/null +++ b/unit_01/w02d02/homework/CSS_Mockups/README.md @@ -0,0 +1,55 @@ +![ga](http://mobbook.generalassemb.ly/ga_cog.png) + +# WDI-PANTHALASSA + +--- +Title: CSS Mockup Homework w02d02
+Type: Homework
+Duration: "2:00"
+Creator:
+ Original creators: WDI-Archer, WDI-Funke
+ Adapted by: Kristyn Bryan
+ Course: WDIr Panthalassa
+Competencies: CSS, HTML
+Prerequisites: CSS, HTML
+ +--- + +# Homework - Master Your Mockup + +![mockup picture with cat](http://www.oddities123.com/wp-content/uploads/2013/06/funny-twins-8.jpg) + +For tonight's homework you have the option of doing one of two website mockups. We have provided the image files needed to create a mockup for each website, but you will need to create the `index.hml` file and the `style.css`. + +Decide whether you want to re-create `VSSL` or `Supply`. + +Do the following commits: + +**Commit 1**
+
+Once you have setup the basic structure in your HTML file, save it, add it, and commit it. The commit message should read:
+"Set up basic HTML file" +
+ +**Commit 2**
+
+Once you have created and saved your CSS file, add it and commit it. The commit message should read:
+"Created a CSS file" +
+ +**Commit 3**
+
+Once you have linked your CSS file to your HTML file (make sure to test it - change the background color of the page to ensure that it's properly linked), add it and commit it. Need a reminder on how to do this? Check out this link on how to [link an external style sheet] (http://www.w3schools.com/css/css_howto.asp). +The commit message should read:
+"The CSS file is successfully linked to the HTML file" +
+ +**Commit 4**
+
+Once you have the pictures displaying on your page (they don't have to be in the right place on the page, they just need to be on your page), take a screenshot, title it `mockup_with_pictures_pre_styling`. Save this to your homework folder. The commit message should read:
+"The images were loaded to the HTML, but not styled yet" +
+ +**Commit 5**
+
+Once you have successfully created the mockup (or once you're too tired to continue and need to go to bed), take a screenshot of your work and title it `mockup_with_styling`. Save this to your homework folder. Come up with your own appropriate commit message.
diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index 4108698..e69de29 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -1,55 +0,0 @@ -![ga](http://mobbook.generalassemb.ly/ga_cog.png) - -# WDI-PANTHALASSA - ---- -Title: CSS Mockup Homework w02d02
-Type: Homework
-Duration: "2:00"
-Creator:
- Original creators: WDI-Archer, WDI-Funke
- Adapted by: Kristyn Bryan
- Course: WDIr Panthalassa
-Competencies: CSS, HTML
-Prerequisites: CSS, HTML
- ---- - -# Homework - Master Your Mockup - -![mockup picture with cat](http://www.oddities123.com/wp-content/uploads/2013/06/funny-twins-8.jpg) - -For tonight's homework you have the option of doing one of two website mockups. We have provided the image files needed to create a mockup for each website, but you will need to create the `index.hml` file and the `style.css`. - -Decide whether you want to re-create `VSSL` or `Supply`. - -Do the following commits: - -**Commit 1**
-
-Once you have setup the basic structure in your HTML file, save it, add it, and commit it. The commit message should read:
-"Set up basic HTML file" -
- -**Commit 2**
-
-Once you have created and saved your CSS file, add it and commit it. The commit message should read:
-"Created a CSS file" -
- -**Commit 3**
-
-Once you have linked your CSS file to your HTML file (make sure to test it - change the background color of the page to ensure that it's properly linked), add it and commit it. Need a reminder on how to do this? Check out this link on how to [link an external style sheet] (http://www.w3schools.com/css/css_howto.asp). -The commit message should read:
-"The CSS file is successfully linked to the HTML file" -
- -**Commit 4**
-
-Once you have the pictures displaying on your page (they don't have to be in the right place on the page, they just need to be on your page), take a screenshot, title it `mockup_with_pictures_pre_styling`. Save this to your homework folder. The commit message should read:
-"The images were loaded to the HTML, but not styled yet" -
- -**Commit 5**
-
-Once you have successfully created the mockup (or once you're too tired to continue and need to go to bed), take a screenshot of your work and title it `mockup_with_styling`. Save this to your homework folder. Come up with your own appropriate commit message.
From bdd5a38d1f7f09cbe83f9833292709e16fcc127f Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 17:12:39 -0400 Subject: [PATCH 21/29] Update README.md --- unit_01/w02d02/homework/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index e69de29..8876f0b 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -0,0 +1,25 @@ + +# WDI-PANTHALASSA + +--- +Title: Homework w02d02
+Type: Homework
+Duration: "4:00"
+Creator:
+ Original creators: WDI-Archer, WDI-Funke, WDI-Meeseeks
+ Adapted by: Kristyn Bryan
+ Course: WDIr Panthalassa
+Competencies: CSS, HTML, DOM manipulation
+Prerequisites: CSS, HTML
+ +--- + +# Homework + +1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01). +2) CSS Mockup homework + +Note: If you finish LOTR and finish coding one of the mockups, please code the second mockup as well. + +Submit this homework by 10:00 am EDT on Thursday, May 26. If you need a refresher on how to submit your homework, follow [these directions](https://github.com/ga-students/wdi-remote/wiki/Homework-Submission). + From a804d0e4ccfcfbb6d9cd8fc9b13b5d52c8a6f75f Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 17:13:05 -0400 Subject: [PATCH 22/29] Update README.md --- unit_01/w02d02/homework/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index 8876f0b..dc23308 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -17,6 +17,7 @@ Prerequisites: CSS, HTML
# Homework 1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01). + 2) CSS Mockup homework Note: If you finish LOTR and finish coding one of the mockups, please code the second mockup as well. From d578d80754c9b7f3495891c94f8294cea9b24f15 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 17:14:26 -0400 Subject: [PATCH 23/29] Update README.md --- unit_01/w02d02/homework/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index dc23308..f8a025d 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -1,3 +1,4 @@ +![ga](http://mobbook.generalassemb.ly/ga_cog.png) # WDI-PANTHALASSA From 55f631d804a31986730bc2dfea9ed68891441550 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 18:06:21 -0400 Subject: [PATCH 24/29] Rename memory.md to README.md --- unit_01/w02d04/homework/memory_starter/{memory.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename unit_01/w02d04/homework/memory_starter/{memory.md => README.md} (100%) diff --git a/unit_01/w02d04/homework/memory_starter/memory.md b/unit_01/w02d04/homework/memory_starter/README.md similarity index 100% rename from unit_01/w02d04/homework/memory_starter/memory.md rename to unit_01/w02d04/homework/memory_starter/README.md From ac7bbfb68e2305b5596f166b047c1e383b5405ee Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 18:10:17 -0400 Subject: [PATCH 25/29] Update README.md --- unit_01/w02d04/homework/memory_starter/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unit_01/w02d04/homework/memory_starter/README.md b/unit_01/w02d04/homework/memory_starter/README.md index 89b0ef4..6e09bd0 100644 --- a/unit_01/w02d04/homework/memory_starter/README.md +++ b/unit_01/w02d04/homework/memory_starter/README.md @@ -1,7 +1,9 @@ # Memory! -Today we are going to build the game Memory. Write all your code in app.js, but -look at index.html to get your bearings. +Tonight you are going to build the game called: [Memory](https://en.wikipedia.org/wiki/Concentration_(game)). We have provided you with a few starter files. You will look at the `index.html` to set up your physical board and cards, but write the code in your `app.js` file to get your game to work. + +Take it one step at a time. Follow these instructions to help get you going. + ### You will need From 0004d882b897a17fac38ac304f73e0695c60d3be Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 18:15:57 -0400 Subject: [PATCH 26/29] Update README.md --- unit_01/w02d02/homework/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index f8a025d..2611333 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -18,10 +18,12 @@ Prerequisites: CSS, HTML
# Homework 1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01). +** NOTE: ** This is due Wednesday, May 25th at 10:00 am EDT. 2) CSS Mockup homework +** NOTE: ** This is due Thursday, May 26th at 10:00 am EDT. -Note: If you finish LOTR and finish coding one of the mockups, please code the second mockup as well. +If you finish LOTR and finish coding one of the mockups, please code the second mockup as well. -Submit this homework by 10:00 am EDT on Thursday, May 26. If you need a refresher on how to submit your homework, follow [these directions](https://github.com/ga-students/wdi-remote/wiki/Homework-Submission). +If you need a refresher on how to submit your homework, follow [these directions](https://github.com/ga-students/wdi-remote/wiki/Homework-Submission). From e228337e5f78e4d8ad3b19fa56afec5f9aea20af Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Mon, 23 May 2016 18:16:50 -0400 Subject: [PATCH 27/29] Update README.md --- unit_01/w02d02/homework/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index 2611333..635db98 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -17,11 +17,11 @@ Prerequisites: CSS, HTML
# Homework -1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01). -** NOTE: ** This is due Wednesday, May 25th at 10:00 am EDT. +1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01).
+***NOTE:*** This is due Wednesday, May 25th at 10:00 am EDT. -2) CSS Mockup homework -** NOTE: ** This is due Thursday, May 26th at 10:00 am EDT. +2) CSS Mockup homework
+***NOTE:*** This is due Thursday, May 26th at 10:00 am EDT. If you finish LOTR and finish coding one of the mockups, please code the second mockup as well. From a2b59109c4fcd2c0dcaa7a407b053f8f96af9045 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Tue, 24 May 2016 17:18:23 -0400 Subject: [PATCH 28/29] Update README.md --- unit_01/w02d02/homework/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index 635db98..2a5fe47 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -18,12 +18,15 @@ Prerequisites: CSS, HTML
# Homework 1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01).
-***NOTE:*** This is due Wednesday, May 25th at 10:00 am EDT. +***NOTE:*** This is due tomorrow, Wednesday, May 25th at 10:00 am EDT. 2) CSS Mockup homework
***NOTE:*** This is due Thursday, May 26th at 10:00 am EDT. -If you finish LOTR and finish coding one of the mockups, please code the second mockup as well. +_If you finish LOTR and finish coding one of the mockups_, please do one of the following: + +- More DOM practice: [click here]( https://github.com/ga-students/wdi-remote/blob/master/unit_01/w02d01/student_labs/ga_dom.md) +- More CSS practice: code the second mockup as well. If you need a refresher on how to submit your homework, follow [these directions](https://github.com/ga-students/wdi-remote/wiki/Homework-Submission). From 3697a83a2ba03357bf7b400502dbbb02617ae982 Mon Sep 17 00:00:00 2001 From: Kristyn Bryan Date: Tue, 24 May 2016 17:19:17 -0400 Subject: [PATCH 29/29] Update README.md --- unit_01/w02d02/homework/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit_01/w02d02/homework/README.md b/unit_01/w02d02/homework/README.md index 2a5fe47..6efd9ac 100644 --- a/unit_01/w02d02/homework/README.md +++ b/unit_01/w02d02/homework/README.md @@ -18,10 +18,10 @@ Prerequisites: CSS, HTML
# Homework 1) Finish working on the Lord of the Rings (LOTR) homework that you began yesterday (w02d01).
-***NOTE:*** This is due tomorrow, Wednesday, May 25th at 10:00 am EDT. +***Due Date:*** Tomorrow, Wednesday, May 25th at 10:00 am EDT. 2) CSS Mockup homework
-***NOTE:*** This is due Thursday, May 26th at 10:00 am EDT. +***Due Date:*** Thursday, May 26th at 10:00 am EDT. _If you finish LOTR and finish coding one of the mockups_, please do one of the following: