From b0e780d9c925f55064115a3b44f232ff92cf9235 Mon Sep 17 00:00:00 2001 From: MarOlivieri <141793518+MarOlivieri@users.noreply.github.com> Date: Thu, 16 May 2024 21:09:09 +0000 Subject: [PATCH 1/2] falta revisar ejercicio 8 --- .learn/resets/01-Hello_World/app.js | 1 + .learn/resets/02.1-Access_and_retrieve/app.js | 8 +++++ .learn/resets/02.2-Retrieve_Items/app.js | 3 ++ .learn/resets/03-Print_the_last_one/app.js | 10 ++++++ .../04.1-Loop_from_one_to_seventeen/app.js | 4 +++ .../04.2-Loop_from_seven_to_twelve/app.js | 1 + .learn/resets/04.3-Add_items_to_array/app.js | 5 +++ .../04.4-Add_items_to_array_looping/app.js | 6 ++++ .learn/resets/05.1-Loop_Array/app.js | 4 +++ .learn/resets/06.2-Loop-from-the-top/app.js | 7 ++++ .learn/resets/06.3-Loop-adding-two/app.js | 7 ++++ .../06.4-Loop-from-the-half-to-the-end/app.js | 10 ++++++ .learn/resets/06.5-One-last-looping/app.js | 3 ++ .learn/resets/07.1-Finding-Waldo/app.js | 3 ++ .learn/resets/07.2-Letter-Counter/app.js | 6 ++++ .learn/resets/07.3-Flip-Array/app.js | 3 ++ .learn/resets/08.1-Mixed-array/app.js | 3 ++ .learn/resets/08.2-Count-On/app.js | 9 ++++++ .learn/resets/08.3-Sum-all-items/app.js | 6 ++++ .learn/resets/09-forEach-loop/app.js | 6 ++++ .learn/resets/10-Everything-is-awesome/app.js | 11 +++++++ .learn/resets/11-Do-while/app.js | 7 ++++ .learn/resets/12-Delete-element/app.js | 7 ++++ .learn/resets/13-Merge-arrays/app.js | 10 ++++++ .learn/resets/14-Divide-and-Conquer/app.js | 3 ++ .../resets/15-Max-integer-from-array/app.js | 3 ++ .learn/resets/16-Foreach-min-val/app.js | 3 ++ .learn/resets/17-The-for-loop/app.js | 3 ++ .learn/resets/18-Nested-arrays/app.js | 3 ++ .../19-And-One-and-a-Two-and-a-Three/app.js | 11 +++++++ .learn/resets/20.1-Map-an-array/app.js | 9 ++++++ .learn/resets/20.2-More-mapping/app.js | 5 +++ .../app.js | 7 ++++ .learn/resets/20.4-Map-data-types/app.js | 8 +++++ .../resets/20.5-Map-arrays-of-objects/app.js | 14 ++++++++ .learn/resets/20.6-Yes-and-no/app.js | 3 ++ .learn/resets/21-Filter-an-array/app.js | 5 +++ .learn/resets/21.2-Filter-done-tasks/app.js | 12 +++++++ .learn/resets/21.3-Filter-list/app.js | 5 +++ .learn/resets/22-Matrix-Builder/app.js | 6 ++++ .learn/resets/23-Parking-Lot/app.js | 11 +++++++ .learn/resets/24-Making-a-ul/app.js | 32 +++++++++++++++++++ .learn/resets/25-Techno-beat/app.js | 9 ++++++ exercises/01-Hello_World/app.js | 3 +- exercises/02.1-Access_and_retrieve/app.js | 5 ++- exercises/02.2-Retrieve_Items/app.js | 2 ++ exercises/03-Print_the_last_one/app.js | 2 ++ .../04.1-Loop_from_one_to_seventeen/app.js | 1 + .../04.2-Loop_from_seven_to_twelve/app.js | 3 ++ exercises/04.3-Add_items_to_array/app.js | 3 +- .../04.4-Add_items_to_array_looping/app.js | 4 +++ exercises/05.1-Loop_Array/app.js | 5 ++- exercises/06.2-Loop-from-the-top/app.js | 4 ++- exercises/06.3-Loop-adding-two/app.js | 2 +- .../06.4-Loop-from-the-half-to-the-end/app.js | 6 ++-- exercises/06.5-One-last-looping/app.js | 4 +++ exercises/07.1-Finding-Waldo/app.js | 6 ++++ exercises/07.2-Letter-Counter/app.js | 10 ++++++ exercises/07.3-Flip-Array/app.js | 6 ++++ exercises/08.1-Mixed-array/app.js | 6 ++++ exercises/08.2-Count-On/app.js | 3 ++ exercises/08.3-Sum-all-items/app.js | 5 ++- exercises/09-forEach-loop/app.js | 2 ++ exercises/10-Everything-is-awesome/app.js | 5 +++ exercises/11-Do-while/app.js | 8 ++++- exercises/12-Delete-element/app.js | 5 ++- exercises/13-Merge-arrays/app.js | 6 ++++ exercises/14-Divide-and-Conquer/app.js | 14 ++++++++ exercises/15-Max-integer-from-array/app.js | 13 ++++++++ exercises/16-Foreach-min-val/app.js | 9 ++++++ exercises/17-The-for-loop/app.js | 8 +++++ exercises/18-Nested-arrays/app.js | 4 +++ .../19-And-One-and-a-Two-and-a-Three/app.js | 2 +- exercises/20.1-Map-an-array/app.js | 3 +- exercises/20.2-More-mapping/app.js | 6 ++++ .../app.js | 4 +++ exercises/20.4-Map-data-types/app.js | 4 +-- exercises/20.5-Map-arrays-of-objects/app.js | 12 +++++-- exercises/20.6-Yes-and-no/app.js | 7 ++++ exercises/21-Filter-an-array/app.js | 7 ++-- exercises/21.2-Filter-done-tasks/app.js | 6 ++++ exercises/21.3-Filter-list/app.js | 5 +++ exercises/22-Matrix-Builder/app.js | 16 ++++++++++ exercises/23-Parking-Lot/app.js | 22 +++++++++++++ exercises/24-Making-a-ul/app.js | 2 ++ exercises/25-Techno-beat/app.js | 21 +++++++++++- 86 files changed, 542 insertions(+), 21 deletions(-) create mode 100644 .learn/resets/01-Hello_World/app.js create mode 100644 .learn/resets/02.1-Access_and_retrieve/app.js create mode 100644 .learn/resets/02.2-Retrieve_Items/app.js create mode 100644 .learn/resets/03-Print_the_last_one/app.js create mode 100644 .learn/resets/04.1-Loop_from_one_to_seventeen/app.js create mode 100644 .learn/resets/04.2-Loop_from_seven_to_twelve/app.js create mode 100644 .learn/resets/04.3-Add_items_to_array/app.js create mode 100644 .learn/resets/04.4-Add_items_to_array_looping/app.js create mode 100644 .learn/resets/05.1-Loop_Array/app.js create mode 100644 .learn/resets/06.2-Loop-from-the-top/app.js create mode 100644 .learn/resets/06.3-Loop-adding-two/app.js create mode 100644 .learn/resets/06.4-Loop-from-the-half-to-the-end/app.js create mode 100644 .learn/resets/06.5-One-last-looping/app.js create mode 100644 .learn/resets/07.1-Finding-Waldo/app.js create mode 100644 .learn/resets/07.2-Letter-Counter/app.js create mode 100644 .learn/resets/07.3-Flip-Array/app.js create mode 100644 .learn/resets/08.1-Mixed-array/app.js create mode 100644 .learn/resets/08.2-Count-On/app.js create mode 100644 .learn/resets/08.3-Sum-all-items/app.js create mode 100644 .learn/resets/09-forEach-loop/app.js create mode 100644 .learn/resets/10-Everything-is-awesome/app.js create mode 100644 .learn/resets/11-Do-while/app.js create mode 100644 .learn/resets/12-Delete-element/app.js create mode 100644 .learn/resets/13-Merge-arrays/app.js create mode 100644 .learn/resets/14-Divide-and-Conquer/app.js create mode 100644 .learn/resets/15-Max-integer-from-array/app.js create mode 100644 .learn/resets/16-Foreach-min-val/app.js create mode 100644 .learn/resets/17-The-for-loop/app.js create mode 100644 .learn/resets/18-Nested-arrays/app.js create mode 100644 .learn/resets/19-And-One-and-a-Two-and-a-Three/app.js create mode 100644 .learn/resets/20.1-Map-an-array/app.js create mode 100644 .learn/resets/20.2-More-mapping/app.js create mode 100644 .learn/resets/20.3-Map-with-function-inside-variable/app.js create mode 100644 .learn/resets/20.4-Map-data-types/app.js create mode 100644 .learn/resets/20.5-Map-arrays-of-objects/app.js create mode 100644 .learn/resets/20.6-Yes-and-no/app.js create mode 100644 .learn/resets/21-Filter-an-array/app.js create mode 100644 .learn/resets/21.2-Filter-done-tasks/app.js create mode 100644 .learn/resets/21.3-Filter-list/app.js create mode 100644 .learn/resets/22-Matrix-Builder/app.js create mode 100644 .learn/resets/23-Parking-Lot/app.js create mode 100644 .learn/resets/24-Making-a-ul/app.js create mode 100644 .learn/resets/25-Techno-beat/app.js diff --git a/.learn/resets/01-Hello_World/app.js b/.learn/resets/01-Hello_World/app.js new file mode 100644 index 00000000..d455757d --- /dev/null +++ b/.learn/resets/01-Hello_World/app.js @@ -0,0 +1 @@ +// console log hello world here \ No newline at end of file diff --git a/.learn/resets/02.1-Access_and_retrieve/app.js b/.learn/resets/02.1-Access_and_retrieve/app.js new file mode 100644 index 00000000..70c752f1 --- /dev/null +++ b/.learn/resets/02.1-Access_and_retrieve/app.js @@ -0,0 +1,8 @@ +// Declaring the array +let myArray = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; + +// 1. print the 3rd item here + +// 2. change the 'thursday' value to null here + +// 3. print the position of step 2 diff --git a/.learn/resets/02.2-Retrieve_Items/app.js b/.learn/resets/02.2-Retrieve_Items/app.js new file mode 100644 index 00000000..00055b71 --- /dev/null +++ b/.learn/resets/02.2-Retrieve_Items/app.js @@ -0,0 +1,3 @@ +let arr = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]; + +// your code here diff --git a/.learn/resets/03-Print_the_last_one/app.js b/.learn/resets/03-Print_the_last_one/app.js new file mode 100644 index 00000000..e4dc515a --- /dev/null +++ b/.learn/resets/03-Print_the_last_one/app.js @@ -0,0 +1,10 @@ +function generateRandomArray() +{ + let auxArray = []; + let randomLength = Math.floor(Math.random()*100); + for(let i = 0; i < randomLength; i++) auxArray.push(Math.floor(Math.random()*100)); + return auxArray; +} +let myStupidArray = generateRandomArray(); + +// Your code here diff --git a/.learn/resets/04.1-Loop_from_one_to_seventeen/app.js b/.learn/resets/04.1-Loop_from_one_to_seventeen/app.js new file mode 100644 index 00000000..11c47dca --- /dev/null +++ b/.learn/resets/04.1-Loop_from_one_to_seventeen/app.js @@ -0,0 +1,4 @@ +// Change the conditions of the for loop +for(let number = 0; number < 10; number++) { + // Print the number +} diff --git a/.learn/resets/04.2-Loop_from_seven_to_twelve/app.js b/.learn/resets/04.2-Loop_from_seven_to_twelve/app.js new file mode 100644 index 00000000..877a3aa0 --- /dev/null +++ b/.learn/resets/04.2-Loop_from_seven_to_twelve/app.js @@ -0,0 +1 @@ +// Your code here diff --git a/.learn/resets/04.3-Add_items_to_array/app.js b/.learn/resets/04.3-Add_items_to_array/app.js new file mode 100644 index 00000000..5e894127 --- /dev/null +++ b/.learn/resets/04.3-Add_items_to_array/app.js @@ -0,0 +1,5 @@ +let arr = [4,5,734,43,45]; + +// Your code here, use the push() function and the 2 Math functions + +console.log(arr); diff --git a/.learn/resets/04.4-Add_items_to_array_looping/app.js b/.learn/resets/04.4-Add_items_to_array_looping/app.js new file mode 100644 index 00000000..96d178f5 --- /dev/null +++ b/.learn/resets/04.4-Add_items_to_array_looping/app.js @@ -0,0 +1,6 @@ +let arr = [4,5,734,43,45]; + +//***************** +// Your code here +// you need to loop 10 times, for example, using a for loop +//***************** diff --git a/.learn/resets/05.1-Loop_Array/app.js b/.learn/resets/05.1-Loop_Array/app.js new file mode 100644 index 00000000..a6e43be3 --- /dev/null +++ b/.learn/resets/05.1-Loop_Array/app.js @@ -0,0 +1,4 @@ +let myArray = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,3,5,5365743,52,34,3,55,33,435,4,6,54,63,45,4,67,56,47,1,34,54,32,54,1,78,98,0,9,8,98,76,7,54,2,3,42,456,4,3321,5]; + +// wrap this console.log within a loop and replace 0 with i +console.log(myArray[0]); diff --git a/.learn/resets/06.2-Loop-from-the-top/app.js b/.learn/resets/06.2-Loop-from-the-top/app.js new file mode 100644 index 00000000..0d4498bb --- /dev/null +++ b/.learn/resets/06.2-Loop-from-the-top/app.js @@ -0,0 +1,7 @@ +let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; + + +for(let i = 0; i < mySampleArray.length; i = i + 1) +{ + console.log(mySampleArray[i]); +} diff --git a/.learn/resets/06.3-Loop-adding-two/app.js b/.learn/resets/06.3-Loop-adding-two/app.js new file mode 100644 index 00000000..0d4498bb --- /dev/null +++ b/.learn/resets/06.3-Loop-adding-two/app.js @@ -0,0 +1,7 @@ +let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; + + +for(let i = 0; i < mySampleArray.length; i = i + 1) +{ + console.log(mySampleArray[i]); +} diff --git a/.learn/resets/06.4-Loop-from-the-half-to-the-end/app.js b/.learn/resets/06.4-Loop-from-the-half-to-the-end/app.js new file mode 100644 index 00000000..697e1894 --- /dev/null +++ b/.learn/resets/06.4-Loop-from-the-half-to-the-end/app.js @@ -0,0 +1,10 @@ +let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; + +let initialValue = 0; +let stopValue = 0; +let increasingValue = 0; + +for(let i = initialValue; i < stopValue; i = i + increasingValue) +{ + console.log(mySampleArray[i]); +} diff --git a/.learn/resets/06.5-One-last-looping/app.js b/.learn/resets/06.5-One-last-looping/app.js new file mode 100644 index 00000000..13857e27 --- /dev/null +++ b/.learn/resets/06.5-One-last-looping/app.js @@ -0,0 +1,3 @@ +let mySampleArray = ['Esmeralda', 'Kiko', 'Ruth', 'Lebron', 'Pedro', 'Maria', 'Lou', 'Fernando', 'Cesco', 'Bart', 'Annie']; + +// Your code here diff --git a/.learn/resets/07.1-Finding-Waldo/app.js b/.learn/resets/07.1-Finding-Waldo/app.js new file mode 100644 index 00000000..e73f48e0 --- /dev/null +++ b/.learn/resets/07.1-Finding-Waldo/app.js @@ -0,0 +1,3 @@ +let people = [ 'Lebron','Aaliyah','Diamond','Dominique','Aliyah','Jazmin','Darnell','Hatfield','Hawkins','Hayden','Hayes','Haynes','Hays','Head','Heath','Hebert','Henderson','Hendricks','Hendrix','Henry','Hensley','Henson','Herman','Hernandez','Herrera','Herring','Hess','Hester','Hewitt','Hickman','Hicks','Higgins','Hill','Hines','Hinton','Hobbs','Hodge','Hodges','Hoffman','Hogan','Holcomb','Holden','Holder','Holland','Holloway','Holman','Holmes','Holt','Hood','Hooper','Hoover','Hopkins','Hopper','Horn','Horne','Horton','House','Houston','Howard','Howe','Howell','Hubbard','Huber','Hudson','Huff','Waldo','Hughes','Hull','Humphrey','Hunt','Hunter','Hurley','Hurst','Hutchinson','Hyde','Ingram','Irwin','Jackson','Jacobs','Jacobson','James','Jarvis','Jefferson','Jenkins','Jennings','Jensen','Jimenez','Johns','Johnson','Johnston','Jones','Jordan','Joseph','Joyce','Joyner','Juarez','Justice','Kane','Kaufman','Keith','Keller','Kelley','Kelly','Kemp','Kennedy','Kent','Kerr','Key','Kidd','Kim','King','Kinney','Kirby','Kirk','Kirkland','Klein','Kline','Knapp','Knight','Knowles','Knox','Koch','Kramer','Lamb','Lambert','Lancaster','Landry','Lane','Lang','Langley','Lara','Larsen','Larson','Lawrence','Lawson','Le','Leach','Leblanc','Lee','Leon','Leonard','Lester','Levine','Levy','Lewis','Lindsay','Lindsey','Little','Livingston','Lloyd','Logan','Long','Lopez','Lott','Love','Lowe','Lowery','Lucas','Luna','Lynch','Lynn','Lyons','Macdonald','Macias','Mack','Madden','Maddox','Maldonado','Malone','Mann','Manning','Marks','Marquez','Marsh','Marshall','Martin','Martinez','Mason','Massey','Mathews','Mathis','Matthews','Maxwell','May','Mayer','Maynard','Mayo','Mays','Mcbride','Mccall','Mccarthy','Mccarty','Mcclain','Mcclure','Mcconnell','Mccormick','Mccoy','Mccray','Waldo','Mcdaniel','Mcdonald','Mcdowell','Mcfadden','Mcfarland','Mcgee','Mcgowan','Mcguire','Mcintosh','Mcintyre','Mckay','Mckee','Mckenzie','Mckinney','Mcknight','Mclaughlin','Mclean','Mcleod','Mcmahon','Mcmillan','Mcneil','Mcpherson','Meadows','Medina','Mejia','Melendez','Melton','Mendez','Mendoza','Mercado','Mercer','Merrill','Merritt','Meyer','Meyers','Michael','Middleton','Miles','Miller','Mills','Miranda','Mitchell','Molina','Monroe','Lucas','Jake','Scott','Amy','Molly','Hannah','Lucas'] ; + +// Loop here to find waldo, use an if conditional inside the loop diff --git a/.learn/resets/07.2-Letter-Counter/app.js b/.learn/resets/07.2-Letter-Counter/app.js new file mode 100644 index 00000000..c2557ef2 --- /dev/null +++ b/.learn/resets/07.2-Letter-Counter/app.js @@ -0,0 +1,6 @@ +let par = "Lorem ipsum dolor sit amet consectetur adipiscing elit Curabitur eget bibendum turpis Curabitur scelerisque eros ultricies venenatis mi at tempor nisl Integer tincidunt accumsan cursus" +let counts = {}; + +// Your code here + +console.log(counts); diff --git a/.learn/resets/07.3-Flip-Array/app.js b/.learn/resets/07.3-Flip-Array/app.js new file mode 100644 index 00000000..6d1a63d4 --- /dev/null +++ b/.learn/resets/07.3-Flip-Array/app.js @@ -0,0 +1,3 @@ +let arr = [45,67,87,23,5,32,60]; + +// Your code here diff --git a/.learn/resets/08.1-Mixed-array/app.js b/.learn/resets/08.1-Mixed-array/app.js new file mode 100644 index 00000000..15dcd2e8 --- /dev/null +++ b/.learn/resets/08.1-Mixed-array/app.js @@ -0,0 +1,3 @@ +let mix = [42, true, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]; + +// Your code here diff --git a/.learn/resets/08.2-Count-On/app.js b/.learn/resets/08.2-Count-On/app.js new file mode 100644 index 00000000..7d75c74a --- /dev/null +++ b/.learn/resets/08.2-Count-On/app.js @@ -0,0 +1,9 @@ +let myArray = [42, true, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]; + +let hello = []; +for(let i = 0; i < myArray.length; i++) { + let item = myArray[i]; + // MAGIC HAPPENS HERE +} + +console.log(hello) diff --git a/.learn/resets/08.3-Sum-all-items/app.js b/.learn/resets/08.3-Sum-all-items/app.js new file mode 100644 index 00000000..ad2ffb38 --- /dev/null +++ b/.learn/resets/08.3-Sum-all-items/app.js @@ -0,0 +1,6 @@ +function sumTheElements(theArray) { + let total = 0; + // Your code here + + return total; +} diff --git a/.learn/resets/09-forEach-loop/app.js b/.learn/resets/09-forEach-loop/app.js new file mode 100644 index 00000000..18b3206d --- /dev/null +++ b/.learn/resets/09-forEach-loop/app.js @@ -0,0 +1,6 @@ +let myArray = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,4356,345,4545,452,345,434,36,345,4334,5454,345,4352,23,365,345,47,63,425,6578759,768,834,754,35,32,445,453456,56,7536867,3884526,4234,35353245,53244523,566785,7547,743,4324,523472634,26665,63432,54645,32,453625,7568,5669576,754,64356,542644,35,243,371,3251,351223,13231243,734,856,56,53,234342,56,545343]; + +myArray.forEach(function(item, index, arr) { + // The value of the item is + console.log(item); +}); diff --git a/.learn/resets/10-Everything-is-awesome/app.js b/.learn/resets/10-Everything-is-awesome/app.js new file mode 100644 index 00000000..cc761072 --- /dev/null +++ b/.learn/resets/10-Everything-is-awesome/app.js @@ -0,0 +1,11 @@ +let myArray = [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 1 ]; + +const ZerosToYahoos = (arr) => { + let return_array = []; + arr.forEach((item) => { + // magic goes inside these brackets + }); + return return_array; +}; + +console.log(ZerosToYahoos(myArray)); diff --git a/.learn/resets/11-Do-while/app.js b/.learn/resets/11-Do-while/app.js new file mode 100644 index 00000000..d14baa15 --- /dev/null +++ b/.learn/resets/11-Do-while/app.js @@ -0,0 +1,7 @@ +let i = 20; + +do { + // Magic goes here + + i--; +} while (i >= 0); diff --git a/.learn/resets/12-Delete-element/app.js b/.learn/resets/12-Delete-element/app.js new file mode 100644 index 00000000..d267b379 --- /dev/null +++ b/.learn/resets/12-Delete-element/app.js @@ -0,0 +1,7 @@ +let people = ['juan','ana','michelle','daniella','stefany','lucy','barak', 'emilio']; + +// Your code below + +console.log(deletePerson('daniella')); +console.log(deletePerson('juan')); +console.log(deletePerson('emilio')); diff --git a/.learn/resets/13-Merge-arrays/app.js b/.learn/resets/13-Merge-arrays/app.js new file mode 100644 index 00000000..47227125 --- /dev/null +++ b/.learn/resets/13-Merge-arrays/app.js @@ -0,0 +1,10 @@ +let chunkOne = [ 'Lebron', 'Aaliyah', 'Diamond', 'Dominique', 'Aliyah', 'Jazmin', 'Darnell' ]; +let chunkTwo = [ 'Lucas', 'Jake', 'Scott', 'Amy', 'Molly', 'Hannah', 'Lucas' ]; + +const mergeArrays = (firstArray, secondArray) => { + let newArray = [] + // Your code here + return newArray +} + +console.log(mergeArrays(chunkOne, chunkTwo)); diff --git a/.learn/resets/14-Divide-and-Conquer/app.js b/.learn/resets/14-Divide-and-Conquer/app.js new file mode 100644 index 00000000..c9ebb4a4 --- /dev/null +++ b/.learn/resets/14-Divide-and-Conquer/app.js @@ -0,0 +1,3 @@ +let listOfNumbers = [4, 80, 85, 59, 37, 25, 5, 64, 66, 81, 20, 64, 41, 22, 76, 76, 55, 96, 2, 68]; + +// Your code here diff --git a/.learn/resets/15-Max-integer-from-array/app.js b/.learn/resets/15-Max-integer-from-array/app.js new file mode 100644 index 00000000..393ea380 --- /dev/null +++ b/.learn/resets/15-Max-integer-from-array/app.js @@ -0,0 +1,3 @@ +let myArray = [43,23,6,87,43,1,4,6,3,67,8,3445,3,7,5435,63,346,3,456,734,6,34]; + +// Your code here diff --git a/.learn/resets/16-Foreach-min-val/app.js b/.learn/resets/16-Foreach-min-val/app.js new file mode 100644 index 00000000..75181c07 --- /dev/null +++ b/.learn/resets/16-Foreach-min-val/app.js @@ -0,0 +1,3 @@ +let myArray = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,4356,345,4545,452,345,434,36,345,4334,5454,345,4352,23,365,345,47,63,425,6578759,768,834,754,35,32,445,453456,56,7536867,3884526,4234,35353245,53244523,566785,7547,743,4324,523472634,26665,63432,54645,32,453625,7568,5669576,754,64356,542644,35,243,371,3251,351223,13231243,734,856,56,53,234342,56,545343]; + +// Your code here diff --git a/.learn/resets/17-The-for-loop/app.js b/.learn/resets/17-The-for-loop/app.js new file mode 100644 index 00000000..95d45a3c --- /dev/null +++ b/.learn/resets/17-The-for-loop/app.js @@ -0,0 +1,3 @@ +let myArray = [2323, 4344, 2325, 324413, 21234, 24531, 2123, 42234, 544, 456, 345, 42, 5445, 23, 5656, 423]; + +// Your code here diff --git a/.learn/resets/18-Nested-arrays/app.js b/.learn/resets/18-Nested-arrays/app.js new file mode 100644 index 00000000..fe7d400b --- /dev/null +++ b/.learn/resets/18-Nested-arrays/app.js @@ -0,0 +1,3 @@ +let coordinatesArray = [[33.747252, -112.633853], [-33.867886, -63.987], [41.303921, -81.901693], [-33.350534, -71.653268]]; + +// Your code here diff --git a/.learn/resets/19-And-One-and-a-Two-and-a-Three/app.js b/.learn/resets/19-And-One-and-a-Two-and-a-Three/app.js new file mode 100644 index 00000000..d0d994a8 --- /dev/null +++ b/.learn/resets/19-And-One-and-a-Two-and-a-Three/app.js @@ -0,0 +1,11 @@ +let contact = { + fullName: "Jane Doe", + phone: "321-321-4321", + email: "test@test.com" +} + +for (let key in contact) { + // Your code here + +} + diff --git a/.learn/resets/20.1-Map-an-array/app.js b/.learn/resets/20.1-Map-an-array/app.js new file mode 100644 index 00000000..d925c37e --- /dev/null +++ b/.learn/resets/20.1-Map-an-array/app.js @@ -0,0 +1,9 @@ +let arrayOfCelsiusValues = [-2, 34, 56, -10]; + +let arrayOfFahrenheitValues = arrayOfCelsiusValues.map(function(value) { + + // Add your code here and return the new value + +}); + +console.log(arrayOfFahrenheitValues); diff --git a/.learn/resets/20.2-More-mapping/app.js b/.learn/resets/20.2-More-mapping/app.js new file mode 100644 index 00000000..1a978e42 --- /dev/null +++ b/.learn/resets/20.2-More-mapping/app.js @@ -0,0 +1,5 @@ +let myNumbers = [23,234,345,4356234,243,43,56,2]; + +// Your code here + +console.log(newArray); diff --git a/.learn/resets/20.3-Map-with-function-inside-variable/app.js b/.learn/resets/20.3-Map-with-function-inside-variable/app.js new file mode 100644 index 00000000..ce3dffe4 --- /dev/null +++ b/.learn/resets/20.3-Map-with-function-inside-variable/app.js @@ -0,0 +1,7 @@ +let names = ['Alice', 'Bob', 'Marry', 'Joe', 'Hilary', 'Stevia', 'Dylan']; + +let prepender = function(name) { + return 'My name is: '+name; +}; + +// Your code here diff --git a/.learn/resets/20.4-Map-data-types/app.js b/.learn/resets/20.4-Map-data-types/app.js new file mode 100644 index 00000000..0139ef47 --- /dev/null +++ b/.learn/resets/20.4-Map-data-types/app.js @@ -0,0 +1,8 @@ +let mixedDataTypes = ['1', '5', '45', '34', '343', '34', 6556, 323]; + +let newArray = mixedDataTypes.map(function(item) { + // Your code here + return item +}); + +console.log(newArray); diff --git a/.learn/resets/20.5-Map-arrays-of-objects/app.js b/.learn/resets/20.5-Map-arrays-of-objects/app.js new file mode 100644 index 00000000..16f693ef --- /dev/null +++ b/.learn/resets/20.5-Map-arrays-of-objects/app.js @@ -0,0 +1,14 @@ +let people = [ + { name: 'Joe', birthDate: new Date(1986,10,24) }, + { name: 'Bob', birthDate: new Date(1975,5,24) }, + { name: 'Erika', birthDate: new Date(1989,6,12) }, + { name: 'Dylan', birthDate: new Date(1999,12,14) }, + { name: 'Steve', birthDate: new Date(2003,4,24) } +]; + +let simplifier = function(person) { + // Your code here + return person.name; +}; + +console.log(people.map(simplifier)); diff --git a/.learn/resets/20.6-Yes-and-no/app.js b/.learn/resets/20.6-Yes-and-no/app.js new file mode 100644 index 00000000..cb28a338 --- /dev/null +++ b/.learn/resets/20.6-Yes-and-no/app.js @@ -0,0 +1,3 @@ +let theBools = [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; + +// Your code here diff --git a/.learn/resets/21-Filter-an-array/app.js b/.learn/resets/21-Filter-an-array/app.js new file mode 100644 index 00000000..37c66dcc --- /dev/null +++ b/.learn/resets/21-Filter-an-array/app.js @@ -0,0 +1,5 @@ +let allNames = ["Romario", "Boby", "Roosevelt", "Emiliy", "Michael", "Greta", "Patricia", "Danzalee"]; + +// Your code here + +console.log(resultingNames); diff --git a/.learn/resets/21.2-Filter-done-tasks/app.js b/.learn/resets/21.2-Filter-done-tasks/app.js new file mode 100644 index 00000000..1d970558 --- /dev/null +++ b/.learn/resets/21.2-Filter-done-tasks/app.js @@ -0,0 +1,12 @@ +let tasks = [ + { label: "Eat my lunch", done: true }, + { label: "Make the bed", done: false }, + { label: "Have some fun", done: false }, + { label: "Finish the replits", done: false }, + { label: "Finish my exercises", done: true }, + { label: "Ask for a raise", done: false }, + { label: "Read a book", done: true }, + { label: "Make a trip", done: false }, +]; + +// Your code here diff --git a/.learn/resets/21.3-Filter-list/app.js b/.learn/resets/21.3-Filter-list/app.js new file mode 100644 index 00000000..aaf455ca --- /dev/null +++ b/.learn/resets/21.3-Filter-list/app.js @@ -0,0 +1,5 @@ +let names = ['Liam','Emma','Noah','Olivia','William','Ava','James','Isabella','Logan','Sophia','Benjamin','Mia','Mason','Charlotte','Elijah','Amelia','Oliver','Evelyn','Jacob','Abigail','Lucas','Harper','Michael','Emily','Alexander','Elizabeth','Ethan','Avery','Daniel','Sofia','Matthew','Ella','Aiden','Madison','Henry','Scarlett','Joseph','Victoria','Jackson','Aria','Samuel','Grace','Sebastian','Chloe','David','Camila','Carter','Penelope','Wyatt','Riley']; + +// Your code here + +console.log(filterByName(names, 'am')); diff --git a/.learn/resets/22-Matrix-Builder/app.js b/.learn/resets/22-Matrix-Builder/app.js new file mode 100644 index 00000000..93d285e4 --- /dev/null +++ b/.learn/resets/22-Matrix-Builder/app.js @@ -0,0 +1,6 @@ +// Your code here + + + +// Do not change anything from this line down +console.log(matrixBuilder(5)) diff --git a/.learn/resets/23-Parking-Lot/app.js b/.learn/resets/23-Parking-Lot/app.js new file mode 100644 index 00000000..f9b3c27c --- /dev/null +++ b/.learn/resets/23-Parking-Lot/app.js @@ -0,0 +1,11 @@ +let parkingState = [ + [1, 0, 1, 1], + [0, 0, 0, 2], + [1, 1, 2, 1], + [2, 1, 1, 1] +] + +// Your code here + + +console.log(getParkingLotState(parkingState)) diff --git a/.learn/resets/24-Making-a-ul/app.js b/.learn/resets/24-Making-a-ul/app.js new file mode 100644 index 00000000..440079e8 --- /dev/null +++ b/.learn/resets/24-Making-a-ul/app.js @@ -0,0 +1,32 @@ +let allColors = [ + {label: 'Red', sexy: true}, + {label: 'Pink', sexy: false}, + {label: 'Orange', sexy: true}, + {label: 'Brown', sexy: false}, + {label: 'Pink', sexy: true}, + {label: 'Violet', sexy: true}, + {label: 'Purple', sexy: false}, +]; + +function generateLI(color) { + // Your code here +} + +function filterColors(color) { + // Your code here +} + +function generateHTMLFromArray(array) { + + let filteredOptions = array.filter((filterColors)); + let LIs = filteredOptions.map(generateLI); + + let htmlString = ''; + return htmlString; +} + +console.log(generateHTMLFromArray(allColors)); diff --git a/.learn/resets/25-Techno-beat/app.js b/.learn/resets/25-Techno-beat/app.js new file mode 100644 index 00000000..d2d5848b --- /dev/null +++ b/.learn/resets/25-Techno-beat/app.js @@ -0,0 +1,9 @@ +// Your code here + + +// Don't change anything below this line +console.log(lyricsGenerator([0,0,1,1,0,0,0])) +console.log(lyricsGenerator([0,0,1,1,1,0,0,0])) +console.log(lyricsGenerator([0,0,0])) +console.log(lyricsGenerator([1,0,1])) +console.log(lyricsGenerator([1,1,1])) diff --git a/exercises/01-Hello_World/app.js b/exercises/01-Hello_World/app.js index d455757d..6d91d2f4 100644 --- a/exercises/01-Hello_World/app.js +++ b/exercises/01-Hello_World/app.js @@ -1 +1,2 @@ -// console log hello world here \ No newline at end of file +// console log hello world here +console.log("Hello world") \ No newline at end of file diff --git a/exercises/02.1-Access_and_retrieve/app.js b/exercises/02.1-Access_and_retrieve/app.js index 70c752f1..812767c0 100644 --- a/exercises/02.1-Access_and_retrieve/app.js +++ b/exercises/02.1-Access_and_retrieve/app.js @@ -2,7 +2,10 @@ let myArray = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']; // 1. print the 3rd item here - +console.log(myArray[2]); // 2. change the 'thursday' value to null here +myArray[4] = null; + // 3. print the position of step 2 +console.log(myArray[4]); diff --git a/exercises/02.2-Retrieve_Items/app.js b/exercises/02.2-Retrieve_Items/app.js index 00055b71..cd24822b 100644 --- a/exercises/02.2-Retrieve_Items/app.js +++ b/exercises/02.2-Retrieve_Items/app.js @@ -1,3 +1,5 @@ let arr = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]; // your code here +console.log(arr[0]); +console.log(arr[3]); \ No newline at end of file diff --git a/exercises/03-Print_the_last_one/app.js b/exercises/03-Print_the_last_one/app.js index e4dc515a..24206e28 100644 --- a/exercises/03-Print_the_last_one/app.js +++ b/exercises/03-Print_the_last_one/app.js @@ -8,3 +8,5 @@ function generateRandomArray() let myStupidArray = generateRandomArray(); // Your code here +let theLastOne = myStupidArray[myStupidArray.lenght - 1]; +console.log(theLastOne) \ No newline at end of file diff --git a/exercises/04.1-Loop_from_one_to_seventeen/app.js b/exercises/04.1-Loop_from_one_to_seventeen/app.js index 11c47dca..fbae66bb 100644 --- a/exercises/04.1-Loop_from_one_to_seventeen/app.js +++ b/exercises/04.1-Loop_from_one_to_seventeen/app.js @@ -1,4 +1,5 @@ // Change the conditions of the for loop for(let number = 0; number < 10; number++) { // Print the number + console.log(number) } diff --git a/exercises/04.2-Loop_from_seven_to_twelve/app.js b/exercises/04.2-Loop_from_seven_to_twelve/app.js index 877a3aa0..06920a2b 100644 --- a/exercises/04.2-Loop_from_seven_to_twelve/app.js +++ b/exercises/04.2-Loop_from_seven_to_twelve/app.js @@ -1 +1,4 @@ // Your code here +for (var i=7; i>= 12; i++) { + console.log(i) +} \ No newline at end of file diff --git a/exercises/04.3-Add_items_to_array/app.js b/exercises/04.3-Add_items_to_array/app.js index 5e894127..fdf94296 100644 --- a/exercises/04.3-Add_items_to_array/app.js +++ b/exercises/04.3-Add_items_to_array/app.js @@ -1,5 +1,6 @@ let arr = [4,5,734,43,45]; // Your code here, use the push() function and the 2 Math functions - +arr.push(Math.floor(Math.random() *100)); +arr.push(Math.floor(Math.random() *100)); console.log(arr); diff --git a/exercises/04.4-Add_items_to_array_looping/app.js b/exercises/04.4-Add_items_to_array_looping/app.js index 96d178f5..83abc637 100644 --- a/exercises/04.4-Add_items_to_array_looping/app.js +++ b/exercises/04.4-Add_items_to_array_looping/app.js @@ -4,3 +4,7 @@ let arr = [4,5,734,43,45]; // Your code here // you need to loop 10 times, for example, using a for loop //***************** +for (let i=0; i<10; i++){ + arr.push(Math.floor(Math.random() * 100)) +} +console.log(arr); \ No newline at end of file diff --git a/exercises/05.1-Loop_Array/app.js b/exercises/05.1-Loop_Array/app.js index a6e43be3..02e8868f 100644 --- a/exercises/05.1-Loop_Array/app.js +++ b/exercises/05.1-Loop_Array/app.js @@ -1,4 +1,7 @@ let myArray = [232,32,1,4,55,4,3,32,3,24,5,5,5,34,2,3,5,5365743,52,34,3,55,33,435,4,6,54,63,45,4,67,56,47,1,34,54,32,54,1,78,98,0,9,8,98,76,7,54,2,3,42,456,4,3321,5]; // wrap this console.log within a loop and replace 0 with i -console.log(myArray[0]); +for(let i=0; i= stopAt; i = i - 1) { console.log(mySampleArray[i]); } diff --git a/exercises/06.3-Loop-adding-two/app.js b/exercises/06.3-Loop-adding-two/app.js index 0d4498bb..a859d106 100644 --- a/exercises/06.3-Loop-adding-two/app.js +++ b/exercises/06.3-Loop-adding-two/app.js @@ -1,7 +1,7 @@ let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; -for(let i = 0; i < mySampleArray.length; i = i + 1) +for(let i = 0; i < mySampleArray.length; i = i + 2) { console.log(mySampleArray[i]); } diff --git a/exercises/06.4-Loop-from-the-half-to-the-end/app.js b/exercises/06.4-Loop-from-the-half-to-the-end/app.js index 697e1894..a0812d48 100644 --- a/exercises/06.4-Loop-from-the-half-to-the-end/app.js +++ b/exercises/06.4-Loop-from-the-half-to-the-end/app.js @@ -1,8 +1,8 @@ let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; -let initialValue = 0; -let stopValue = 0; -let increasingValue = 0; +let initialValue = mySampleArray.length /2; +let stopValue = mySampleArray.length; +let increasingValue = 1; for(let i = initialValue; i < stopValue; i = i + increasingValue) { diff --git a/exercises/06.5-One-last-looping/app.js b/exercises/06.5-One-last-looping/app.js index 13857e27..8f78c477 100644 --- a/exercises/06.5-One-last-looping/app.js +++ b/exercises/06.5-One-last-looping/app.js @@ -1,3 +1,7 @@ let mySampleArray = ['Esmeralda', 'Kiko', 'Ruth', 'Lebron', 'Pedro', 'Maria', 'Lou', 'Fernando', 'Cesco', 'Bart', 'Annie']; // Your code here +for (let i= mySampleArray.length - 1; i>=0; i=i -1) { + let item =mySampleArray[i]; + console.log(item) +} \ No newline at end of file diff --git a/exercises/07.1-Finding-Waldo/app.js b/exercises/07.1-Finding-Waldo/app.js index e73f48e0..ede0cadf 100644 --- a/exercises/07.1-Finding-Waldo/app.js +++ b/exercises/07.1-Finding-Waldo/app.js @@ -1,3 +1,9 @@ let people = [ 'Lebron','Aaliyah','Diamond','Dominique','Aliyah','Jazmin','Darnell','Hatfield','Hawkins','Hayden','Hayes','Haynes','Hays','Head','Heath','Hebert','Henderson','Hendricks','Hendrix','Henry','Hensley','Henson','Herman','Hernandez','Herrera','Herring','Hess','Hester','Hewitt','Hickman','Hicks','Higgins','Hill','Hines','Hinton','Hobbs','Hodge','Hodges','Hoffman','Hogan','Holcomb','Holden','Holder','Holland','Holloway','Holman','Holmes','Holt','Hood','Hooper','Hoover','Hopkins','Hopper','Horn','Horne','Horton','House','Houston','Howard','Howe','Howell','Hubbard','Huber','Hudson','Huff','Waldo','Hughes','Hull','Humphrey','Hunt','Hunter','Hurley','Hurst','Hutchinson','Hyde','Ingram','Irwin','Jackson','Jacobs','Jacobson','James','Jarvis','Jefferson','Jenkins','Jennings','Jensen','Jimenez','Johns','Johnson','Johnston','Jones','Jordan','Joseph','Joyce','Joyner','Juarez','Justice','Kane','Kaufman','Keith','Keller','Kelley','Kelly','Kemp','Kennedy','Kent','Kerr','Key','Kidd','Kim','King','Kinney','Kirby','Kirk','Kirkland','Klein','Kline','Knapp','Knight','Knowles','Knox','Koch','Kramer','Lamb','Lambert','Lancaster','Landry','Lane','Lang','Langley','Lara','Larsen','Larson','Lawrence','Lawson','Le','Leach','Leblanc','Lee','Leon','Leonard','Lester','Levine','Levy','Lewis','Lindsay','Lindsey','Little','Livingston','Lloyd','Logan','Long','Lopez','Lott','Love','Lowe','Lowery','Lucas','Luna','Lynch','Lynn','Lyons','Macdonald','Macias','Mack','Madden','Maddox','Maldonado','Malone','Mann','Manning','Marks','Marquez','Marsh','Marshall','Martin','Martinez','Mason','Massey','Mathews','Mathis','Matthews','Maxwell','May','Mayer','Maynard','Mayo','Mays','Mcbride','Mccall','Mccarthy','Mccarty','Mcclain','Mcclure','Mcconnell','Mccormick','Mccoy','Mccray','Waldo','Mcdaniel','Mcdonald','Mcdowell','Mcfadden','Mcfarland','Mcgee','Mcgowan','Mcguire','Mcintosh','Mcintyre','Mckay','Mckee','Mckenzie','Mckinney','Mcknight','Mclaughlin','Mclean','Mcleod','Mcmahon','Mcmillan','Mcneil','Mcpherson','Meadows','Medina','Mejia','Melendez','Melton','Mendez','Mendoza','Mercado','Mercer','Merrill','Merritt','Meyer','Meyers','Michael','Middleton','Miles','Miller','Mills','Miranda','Mitchell','Molina','Monroe','Lucas','Jake','Scott','Amy','Molly','Hannah','Lucas'] ; // Loop here to find waldo, use an if conditional inside the loop +for (let i = 0 ; i= 0; i--){ + let item = arr[i]; + flippedArray.push(item); + } + console.log(flippedArray) diff --git a/exercises/08.1-Mixed-array/app.js b/exercises/08.1-Mixed-array/app.js index 15dcd2e8..9160cd42 100644 --- a/exercises/08.1-Mixed-array/app.js +++ b/exercises/08.1-Mixed-array/app.js @@ -1,3 +1,9 @@ let mix = [42, true, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]; // Your code here +let newArray = []; +for (let i=0; i < mix.length; i++){ + const item = mix[i]; + newArray.push (typeof item) +} +console,log(newArray) \ No newline at end of file diff --git a/exercises/08.2-Count-On/app.js b/exercises/08.2-Count-On/app.js index 7d75c74a..97966089 100644 --- a/exercises/08.2-Count-On/app.js +++ b/exercises/08.2-Count-On/app.js @@ -4,6 +4,9 @@ let hello = []; for(let i = 0; i < myArray.length; i++) { let item = myArray[i]; // MAGIC HAPPENS HERE + if(typeof item ==='object'){ + hello.push(item) + } } console.log(hello) diff --git a/exercises/08.3-Sum-all-items/app.js b/exercises/08.3-Sum-all-items/app.js index ad2ffb38..2834531b 100644 --- a/exercises/08.3-Sum-all-items/app.js +++ b/exercises/08.3-Sum-all-items/app.js @@ -1,6 +1,9 @@ function sumTheElements(theArray) { let total = 0; // Your code here - +for (let i = 0; i < theArray.length; i++) { + total += theArray[i] +} return total; } +console.log(sumTheElements([2,13,34,5])) \ No newline at end of file diff --git a/exercises/09-forEach-loop/app.js b/exercises/09-forEach-loop/app.js index 18b3206d..43c7e645 100644 --- a/exercises/09-forEach-loop/app.js +++ b/exercises/09-forEach-loop/app.js @@ -2,5 +2,7 @@ let myArray = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,43 myArray.forEach(function(item, index, arr) { // The value of the item is + if(item%14===0){ console.log(item); +} }); diff --git a/exercises/10-Everything-is-awesome/app.js b/exercises/10-Everything-is-awesome/app.js index cc761072..c720d715 100644 --- a/exercises/10-Everything-is-awesome/app.js +++ b/exercises/10-Everything-is-awesome/app.js @@ -4,6 +4,11 @@ const ZerosToYahoos = (arr) => { let return_array = []; arr.forEach((item) => { // magic goes inside these brackets + if (item === 1){ + return_array.push(item) + } else { + return_array.push('yahoo') + } }); return return_array; }; diff --git a/exercises/11-Do-while/app.js b/exercises/11-Do-while/app.js index d14baa15..e1fb9f6f 100644 --- a/exercises/11-Do-while/app.js +++ b/exercises/11-Do-while/app.js @@ -2,6 +2,12 @@ let i = 20; do { // Magic goes here - +if (i === 0) { + console.log("liftoff"); +}else if (i % 5 === 0){ + console.log(i + "!"); +} else { + console.log(i); +} i--; } while (i >= 0); diff --git a/exercises/12-Delete-element/app.js b/exercises/12-Delete-element/app.js index d267b379..06f61cb6 100644 --- a/exercises/12-Delete-element/app.js +++ b/exercises/12-Delete-element/app.js @@ -1,7 +1,10 @@ let people = ['juan','ana','michelle','daniella','stefany','lucy','barak', 'emilio']; // Your code below - +function deletePerson(name){ + let peopleArray = people.filter((person)=> person !=name) + return peopleArray +} console.log(deletePerson('daniella')); console.log(deletePerson('juan')); console.log(deletePerson('emilio')); diff --git a/exercises/13-Merge-arrays/app.js b/exercises/13-Merge-arrays/app.js index 47227125..48c084f7 100644 --- a/exercises/13-Merge-arrays/app.js +++ b/exercises/13-Merge-arrays/app.js @@ -4,6 +4,12 @@ let chunkTwo = [ 'Lucas', 'Jake', 'Scott', 'Amy', 'Molly', 'Hannah', 'Lucas' ]; const mergeArrays = (firstArray, secondArray) => { let newArray = [] // Your code here + firstArray.forEach(item => { + newArray.push(item) + }) + secondaryArray.forEach(item=>{ + newArray.push(item) + }) return newArray } diff --git a/exercises/14-Divide-and-Conquer/app.js b/exercises/14-Divide-and-Conquer/app.js index c9ebb4a4..82fe424a 100644 --- a/exercises/14-Divide-and-Conquer/app.js +++ b/exercises/14-Divide-and-Conquer/app.js @@ -1,3 +1,17 @@ let listOfNumbers = [4, 80, 85, 59, 37, 25, 5, 64, 66, 81, 20, 64, 41, 22, 76, 76, 55, 96, 2, 68]; // Your code here +function mergeTwoList(array) { + let odd = []; + let even = []; + + for (let i = 0; i < array.length; i++) { + if (array[i] % 2 === 0) { + even.push(array[i]); + } else { + odd.push(array[i]); + } + } + + return odd.concat(even); +} \ No newline at end of file diff --git a/exercises/15-Max-integer-from-array/app.js b/exercises/15-Max-integer-from-array/app.js index 393ea380..c74bb813 100644 --- a/exercises/15-Max-integer-from-array/app.js +++ b/exercises/15-Max-integer-from-array/app.js @@ -1,3 +1,16 @@ let myArray = [43,23,6,87,43,1,4,6,3,67,8,3445,3,7,5435,63,346,3,456,734,6,34]; // Your code here +function findMax(arr) { + + let maxNum = arr[0]; + + for (let i = 1; i < arr.length; i++) { + if (arr[i] > maxNum) + maxNum = arr[i]; + } + + return maxNum; +} + +console.log(findMax(myArray)) \ No newline at end of file diff --git a/exercises/16-Foreach-min-val/app.js b/exercises/16-Foreach-min-val/app.js index 75181c07..e13e42bd 100644 --- a/exercises/16-Foreach-min-val/app.js +++ b/exercises/16-Foreach-min-val/app.js @@ -1,3 +1,12 @@ let myArray = [3344,34334,454543,342534,4563456,3445,23455,234,262,2335,43323,4356,345,4545,452,345,434,36,345,4334,5454,345,4352,23,365,345,47,63,425,6578759,768,834,754,35,32,445,453456,56,7536867,3884526,4234,35353245,53244523,566785,7547,743,4324,523472634,26665,63432,54645,32,453625,7568,5669576,754,64356,542644,35,243,371,3251,351223,13231243,734,856,56,53,234342,56,545343]; // Your code here +let minNum = Infinity; + +myArray.forEach(function(item) { + if (item < minNum) { + minNum = item; + } +}); + +console.log(minNum); \ No newline at end of file diff --git a/exercises/17-The-for-loop/app.js b/exercises/17-The-for-loop/app.js index 95d45a3c..aa318c19 100644 --- a/exercises/17-The-for-loop/app.js +++ b/exercises/17-The-for-loop/app.js @@ -1,3 +1,11 @@ let myArray = [2323, 4344, 2325, 324413, 21234, 24531, 2123, 42234, 544, 456, 345, 42, 5445, 23, 5656, 423]; // Your code here +let totalSum = 0; +for (let i of myArray) { + totalSum += i +} + +let avg = totalSum / myArray.length + +console.log(avg) diff --git a/exercises/18-Nested-arrays/app.js b/exercises/18-Nested-arrays/app.js index fe7d400b..aad896ae 100644 --- a/exercises/18-Nested-arrays/app.js +++ b/exercises/18-Nested-arrays/app.js @@ -1,3 +1,7 @@ let coordinatesArray = [[33.747252, -112.633853], [-33.867886, -63.987], [41.303921, -81.901693], [-33.350534, -71.653268]]; // Your code here +for (let index in coordinatesArray) { + let longitude = coordinatesArray[index][1]; + console.log(longitude) +} diff --git a/exercises/19-And-One-and-a-Two-and-a-Three/app.js b/exercises/19-And-One-and-a-Two-and-a-Three/app.js index d0d994a8..69b85b2e 100644 --- a/exercises/19-And-One-and-a-Two-and-a-Three/app.js +++ b/exercises/19-And-One-and-a-Two-and-a-Three/app.js @@ -6,6 +6,6 @@ let contact = { for (let key in contact) { // Your code here - + console.log(key + " : " + contact[key]) } diff --git a/exercises/20.1-Map-an-array/app.js b/exercises/20.1-Map-an-array/app.js index d925c37e..c34a7c0a 100644 --- a/exercises/20.1-Map-an-array/app.js +++ b/exercises/20.1-Map-an-array/app.js @@ -3,7 +3,8 @@ let arrayOfCelsiusValues = [-2, 34, 56, -10]; let arrayOfFahrenheitValues = arrayOfCelsiusValues.map(function(value) { // Add your code here and return the new value - + return (value * 9.0/5.0) + 32.0; }); console.log(arrayOfFahrenheitValues); + diff --git a/exercises/20.2-More-mapping/app.js b/exercises/20.2-More-mapping/app.js index 1a978e42..a7a6ad74 100644 --- a/exercises/20.2-More-mapping/app.js +++ b/exercises/20.2-More-mapping/app.js @@ -1,5 +1,11 @@ let myNumbers = [23,234,345,4356234,243,43,56,2]; // Your code here +function myFunction(number) { + return number * 3 +} + +let newArray = myNumbers.map(myFunction) +console.log(newArray); console.log(newArray); diff --git a/exercises/20.3-Map-with-function-inside-variable/app.js b/exercises/20.3-Map-with-function-inside-variable/app.js index ce3dffe4..c3df7dad 100644 --- a/exercises/20.3-Map-with-function-inside-variable/app.js +++ b/exercises/20.3-Map-with-function-inside-variable/app.js @@ -5,3 +5,7 @@ let prepender = function(name) { }; // Your code here + +let newArray = names.map(prepender) + +console.log(newArray) diff --git a/exercises/20.4-Map-data-types/app.js b/exercises/20.4-Map-data-types/app.js index 0139ef47..b9334d8a 100644 --- a/exercises/20.4-Map-data-types/app.js +++ b/exercises/20.4-Map-data-types/app.js @@ -2,7 +2,7 @@ let mixedDataTypes = ['1', '5', '45', '34', '343', '34', 6556, 323]; let newArray = mixedDataTypes.map(function(item) { // Your code here - return item + return typeof(item); }); -console.log(newArray); +console.log(newArray) diff --git a/exercises/20.5-Map-arrays-of-objects/app.js b/exercises/20.5-Map-arrays-of-objects/app.js index 16f693ef..0fc76450 100644 --- a/exercises/20.5-Map-arrays-of-objects/app.js +++ b/exercises/20.5-Map-arrays-of-objects/app.js @@ -8,7 +8,15 @@ let people = [ let simplifier = function(person) { // Your code here - return person.name; + let currentDate = new Date(); + let age = currentDate.getFullYear() - person.birthDate.getFullYear(); + let birthDateThisYear = new Date(currentDate.getFullYear(), person.birthDate.getMonth(), person.birthDate.getDate()); + + if (currentDate < birthDateThisYear) { + age = age - 1; + } + + return "Hello, my name is " + person.name + " and I am " + age + " years old"; }; -console.log(people.map(simplifier)); +console.log(people.map(simplifier)); \ No newline at end of file diff --git a/exercises/20.6-Yes-and-no/app.js b/exercises/20.6-Yes-and-no/app.js index cb28a338..fa7537b4 100644 --- a/exercises/20.6-Yes-and-no/app.js +++ b/exercises/20.6-Yes-and-no/app.js @@ -1,3 +1,10 @@ let theBools = [0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; // Your code here + +let newArray = theBools.map(function(item) { + if (item === 0) return "woko" + else if(item === 1) return "wiki" +}) + +console.log(newArray) \ No newline at end of file diff --git a/exercises/21-Filter-an-array/app.js b/exercises/21-Filter-an-array/app.js index 37c66dcc..d8f5edf1 100644 --- a/exercises/21-Filter-an-array/app.js +++ b/exercises/21-Filter-an-array/app.js @@ -1,5 +1,8 @@ let allNames = ["Romario", "Boby", "Roosevelt", "Emiliy", "Michael", "Greta", "Patricia", "Danzalee"]; // Your code here - -console.log(resultingNames); +let resultingNames = allNames.filter(function(item) { + return item[0] === "R"; + }); + + console.log(resultingNames); \ No newline at end of file diff --git a/exercises/21.2-Filter-done-tasks/app.js b/exercises/21.2-Filter-done-tasks/app.js index 1d970558..711bb6eb 100644 --- a/exercises/21.2-Filter-done-tasks/app.js +++ b/exercises/21.2-Filter-done-tasks/app.js @@ -10,3 +10,9 @@ let tasks = [ ]; // Your code here + +let newArray = tasks.filter(function(item) { + return item.done === true; +}); + +console.log(newArray); diff --git a/exercises/21.3-Filter-list/app.js b/exercises/21.3-Filter-list/app.js index aaf455ca..730bed18 100644 --- a/exercises/21.3-Filter-list/app.js +++ b/exercises/21.3-Filter-list/app.js @@ -1,5 +1,10 @@ let names = ['Liam','Emma','Noah','Olivia','William','Ava','James','Isabella','Logan','Sophia','Benjamin','Mia','Mason','Charlotte','Elijah','Amelia','Oliver','Evelyn','Jacob','Abigail','Lucas','Harper','Michael','Emily','Alexander','Elizabeth','Ethan','Avery','Daniel','Sofia','Matthew','Ella','Aiden','Madison','Henry','Scarlett','Joseph','Victoria','Jackson','Aria','Samuel','Grace','Sebastian','Chloe','David','Camila','Carter','Penelope','Wyatt','Riley']; // Your code here +function filterByName(array, filterString) { + let filteredNames = array.filter(item => item.toLowerCase().includes(filterString.toLowerCase())); + return filteredNames; +} console.log(filterByName(names, 'am')); +console.log(filterByName(names, 'am')); diff --git a/exercises/22-Matrix-Builder/app.js b/exercises/22-Matrix-Builder/app.js index 93d285e4..ee91e8ae 100644 --- a/exercises/22-Matrix-Builder/app.js +++ b/exercises/22-Matrix-Builder/app.js @@ -1,4 +1,20 @@ // Your code here +function matrixBuilder(n) { + let matrix = []; + + for (let i = 0; i < n; i++) { + let row = []; + + for (let j = 0; j < n; j++) { + let randomValue = Math.floor(Math.random() + 0.5); + row.push(randomValue); + } + + matrix.push(row); + } + + return matrix; + } diff --git a/exercises/23-Parking-Lot/app.js b/exercises/23-Parking-Lot/app.js index f9b3c27c..1e3e25b4 100644 --- a/exercises/23-Parking-Lot/app.js +++ b/exercises/23-Parking-Lot/app.js @@ -7,5 +7,27 @@ let parkingState = [ // Your code here +function getParkingLotState(parkingArray) { + let state = { + totalSlots: 0, + availableSlots: 0, + occupiedSlots: 0 + } + for (let i = 0; i < parkingArray.length; i++) { + for (let x = 0; x < parkingArray[i].length; x++) { + if (parkingArray[i][x] === 2) { + state.availableSlots += 1 + state.totalSlots += 1 + } + else if (parkingArray[i][x] === 1) { + state.occupiedSlots += 1 + state.totalSlots += 1 + } + } + } + return state +} + +console.log(getParkingLotState(parkingState)); console.log(getParkingLotState(parkingState)) diff --git a/exercises/24-Making-a-ul/app.js b/exercises/24-Making-a-ul/app.js index 440079e8..403c8b0d 100644 --- a/exercises/24-Making-a-ul/app.js +++ b/exercises/24-Making-a-ul/app.js @@ -10,10 +10,12 @@ let allColors = [ function generateLI(color) { // Your code here + return `
  • ${color.label}
  • `; } function filterColors(color) { // Your code here + return color.sexy === true; } function generateHTMLFromArray(array) { diff --git a/exercises/25-Techno-beat/app.js b/exercises/25-Techno-beat/app.js index d2d5848b..0a3f48bc 100644 --- a/exercises/25-Techno-beat/app.js +++ b/exercises/25-Techno-beat/app.js @@ -1,7 +1,26 @@ // Your code here +function lyricsGenerator(arr) { + let finalString = "" + let countOne = 0 + for (let i = 0; i < arr.length; i++) { + if(arr[i] == 0){ + finalString += "Boom " + countOne = 0 + } else if(arr[i] == 1) { + finalString += "Drop the bass " + countOne += 1 -// Don't change anything below this line + if(countOne === 3) { + finalString += "!!!Break the bass!!! " + } + } + } + + return finalString +} + +// Don't change anything bellow this line console.log(lyricsGenerator([0,0,1,1,0,0,0])) console.log(lyricsGenerator([0,0,1,1,1,0,0,0])) console.log(lyricsGenerator([0,0,0])) From 0bf69f54ce615af7bb8cd7915c3694fab1e88331 Mon Sep 17 00:00:00 2001 From: MarOlivieri <141793518+MarOlivieri@users.noreply.github.com> Date: Thu, 16 May 2024 21:16:00 +0000 Subject: [PATCH 2/2] Initial commit