From 06735af1dfa77b7200f661daaf43bb51e4a3f27d Mon Sep 17 00:00:00 2001 From: BlisS Date: Sat, 6 Jan 2018 09:37:33 -0600 Subject: [PATCH 1/4] The description of the test says: "returns the length of the longest one" but the test is expecting for the string itself, i change the Readme file wich is the quck fix, but may be could be good to change the spec file to not confuse the student. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d11b9e6e..81bf62d26 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Define a function `maxOfTwoNumbers` that takes two numbers as arguments and retu ## Finding Longest Word -Write a function `findLongestWord` that takes an array of words and returns the length of the longest one. If there are 2 with the same length, it should return the first occurrence. +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. **Starter Code** From 7450c21f9bf5ffac225679fb6dc04a9e56860ceb Mon Sep 17 00:00:00 2001 From: BlisS Date: Sat, 6 Jan 2018 12:23:51 -0600 Subject: [PATCH 2/4] the test are waiting for undefined but the description says false --- starter-code/tests/FunctionsAndArraysSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starter-code/tests/FunctionsAndArraysSpec.js b/starter-code/tests/FunctionsAndArraysSpec.js index 8fb25ff65..67a3b8bad 100644 --- a/starter-code/tests/FunctionsAndArraysSpec.js +++ b/starter-code/tests/FunctionsAndArraysSpec.js @@ -170,7 +170,7 @@ describe('Counting Repetion - howManyTimes', function () { }); it('returns false with an empty array', function () { - expect(howManyTimes([])).toBe(undefined); + expect(howManyTimes([])).toBe(false); }); it('returns one when the word appears only one time on the array', function () { From a1d52609926d52a50472ab6b0276d22095e09f01 Mon Sep 17 00:00:00 2001 From: chaveroricardo Date: Sat, 27 Oct 2018 17:27:31 -0500 Subject: [PATCH 3/4] Hecho --- .DS_Store | Bin 0 -> 6148 bytes starter-code/.DS_Store | Bin 0 -> 6148 bytes starter-code/src/functions-and-arrays.js | 35 ++++++++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 .DS_Store create mode 100644 starter-code/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e460ec93bf7be8b79d5d43cf58a675b83410039f GIT binary patch literal 6148 zcmeHKPfrs;6n_I%w*_Q@7KmOpHYO%u(i#n32(@6eTv}a%C4gnO9m>Y-PP4nELapg1 z@GhUh#H&Xy9{dC*Ui<2p{KdK!%iM7?Fq^AyDw)CRBk9ct?hafrx>BjRC%QMaWN0{c;o>DtOK6F)#J0J|+Gc2ltsrmtoBXL{g?qNr*BEnu>XyCk z&~`;nE;BE*9FO`U*r`!;*?Qu5HP+6vmRAcz9#alzT3m})^w~})o5{=@cQW01qm#|v zMSbDcLbn^&X0B%!3pl2ex6Um8GDm9%<&CJeRspwO-Ree_X`O7aem-%_OMaxc=d8Ttn%OQOpa;2hA z{^IwT)}9`l)()EJlRP$vTn~Ioz0JDs)QY>i0S(I)eLSf8%ymmFa6*T98z)9LwgOy( zLP#40ZIaAe@#SsTvZ-72@+=HlW5e=&%d6A;0r%wDu#l2Zc_uNF z*|e&TS5Gf}ldPt5n|FKhS5Z<*_w-vDm!5(w*)*Y#u#@dfyG#hF(#lPa#R)w4li`A=wL*Sb7W&bN_?>1 z{IT}^b--`0v5ckc#-D!u{wU0H(|qSEwfgGXx)4p#+-zREqh#vlUOvejFTF(T)XPV{ z*3Xh8`qVxDJRDB@t?i>E&b=@mrZPDUh7fXf5yn9>b&^ROWO5!?IfQ74M!(gb%`DUG z82e_?F=m!^0D5cE)>tZ(TL*M_eMWyB5e0O7OCTB= zZH=Wu@PKfY3aC=KeqwNy4&#Q7vo)3qRXXExWtc~=Ts>a6Tph*@8P2$^ka}W(7?@|E zrpy+e|HtslEPUk8r;tSq5Ci{=0bcL9JqL=?XY04}@T@hU4WOZ5T!{(@=yR6F$gggRp27Z~^eR@_g> literal 0 HcmV?d00001 diff --git a/starter-code/src/functions-and-arrays.js b/starter-code/src/functions-and-arrays.js index 2fcd81e6e..bf2fc83de 100644 --- a/starter-code/src/functions-and-arrays.js +++ b/starter-code/src/functions-and-arrays.js @@ -1,5 +1,11 @@ // Find the maximum - +function maxOfTwoNumbers(numeroUno,numeroDos){ + if(numeroUno > numeroDos){ + return numeroUno + } else{ + return numeroDos + } +}; // Finding Longest Word var words = [ 'mystery', @@ -11,13 +17,34 @@ var words = [ 'crackpot' ]; +var word =""; + +function findLongestWord(words){ + if(words.length<=0) + return undefined; + if(words.length===1) + return words[0]; +if (words.length>0){ + word = words[0]; + for (var i= 0; i < words.length; i++){ + if (word.length < words[i].length){ + word = words[i]; + } + } + return word; +} +} + + // Calculating a Sum var numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10]; -// Calculate the Average - -var numbersAvg = [2, 6, 9, 10, 7, 4, 1, 9]; +function sumArray(numbers){ + if(numbers.length<=0){ + return 0; + } +} // Array of Strings var wordsArr = [ From 400e412b58c4b582cb32f6c40c215e6ee5da9cb8 Mon Sep 17 00:00:00 2001 From: chaveroricardo Date: Sat, 27 Oct 2018 17:55:51 -0500 Subject: [PATCH 4/4] Hecho --- starter-code/.DS_Store | Bin 6148 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/starter-code/.DS_Store b/starter-code/.DS_Store index 5d9dd5edcb8a9dfa84df00da5622023431ae6fee..c8df0160bd630fd1ccf1eb32773844a4d03b22d4 100644 GIT binary patch delta 521 zcmZoMXfc=|#>B!ku~2NHo+2aj#DLw41(=u_nJ4owzO2toE-OgN$xmWnU|gS6kds+l zVqkDzK!A~nnT3^&or9B$n}?T=UqDbuSWrYzR8&+rRLQ8=Q-t<|rOXh0YO49XA&0|N(VNM2%YDyOnT-~osj2ZJ_)BZC)1Fhd4I zIYS@AEQU16G-jm2$40+0D-EDS^xk5 delta 80 zcmZoMXfc=|#>B`mu~2NHo+2aD#DLwC4MbQb^RqnLyo=43akBykJIlm|eVf@i_&I>; dHVblmXP(S2Vky7?1dI#}Oi-F-bA-qmW&l~I5)A+V