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..eec85929 --- /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 item here + +//2. change 'thursday'a value here to null + +//3. print the position of step 2 \ No newline at end of file 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..de6a1d49 --- /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 \ No newline at end of file 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..cc912fbf --- /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..308cd4cc --- /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..8772f7b9 --- /dev/null +++ b/.learn/resets/04.2-Loop_from_seven_to_twelve/app.js @@ -0,0 +1 @@ +//you code here \ No newline at end of file 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..69a54ece --- /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 random function. + +console.log(arr); \ No newline at end of file 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..04f18c52 --- /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 withing a loop and replace 0 with i +console.log(myArray[0]); \ No newline at end of file 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..79b11d5c --- /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 { + let return_array = []; + arr.forEach((item,index) => { + // magic goes inside these brackets + }); + return return_array; +}; + +console.log(ZerosToYahoos(myArray)); \ No newline at end of file diff --git a/.learn/resets/11-Do-while/app.js b/.learn/resets/11-Do-while/app.js new file mode 100644 index 00000000..0db3f713 --- /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); \ No newline at end of file diff --git a/.learn/resets/12-Delete-element/app.js b/.learn/resets/12-Delete-element/app.js new file mode 100644 index 00000000..1bdb10ab --- /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..cffbcdd4 --- /dev/null +++ b/.learn/resets/13-Merge-arrays/app.js @@ -0,0 +1,10 @@ +let chunk_one = [ 'Lebron', 'Aaliyah', 'Diamond', 'Dominique', 'Aliyah', 'Jazmin', 'Darnell' ]; +let chunk_two = [ 'Lucas' , 'Jake','Scott','Amy', 'Molly','Hannah','Lucas']; + +const mergeArrays = (firstArray, secondArray) => { + let newArray = [] + //your code here + return newArray +} + +console.log(mergeArrays(chunk_one, chunk_two)); \ No newline at end of file diff --git a/exercises/01-Hello_World/app.js b/exercises/01-Hello_World/app.js index d455757d..890d8835 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 eec85929..d893e8cf 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 item here +console.log(myArray[2]) //2. change 'thursday'a value here to null +myArray[4] = null; -//3. print the position of step 2 \ No newline at end of file +//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 de6a1d49..2c3c0498 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 \ No newline at end of file +//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 cc912fbf..7b3491df 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.length-1] +console.log(myStupidArray[myStupidArray.length]); \ 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 308cd4cc..b2f8f1fa 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++){ +for(let number = 1; number < 18; 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 8772f7b9..9af45516 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,5 @@ -//you code here \ No newline at end of file +//you code here + +for (let i = 7; i < 13; 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 69a54ece..12c3ff49 100644 --- a/exercises/04.3-Add_items_to_array/app.js +++ b/exercises/04.3-Add_items_to_array/app.js @@ -1,5 +1,8 @@ let arr = [4,5,734,43,45]; // Your code here, use the push function and the random function. +arr.push(Math.floor(Math.random()*100)); +arr.push(Math.floor(Math.random()*100)); + console.log(arr); \ No newline at end of file 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..ec4f7a5b 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,8 @@ 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 04f18c52..84477d4d 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 withing a loop and replace 0 with i -console.log(myArray[0]); \ No newline at end of file + +for ( let i = 0; i < myArray.length; i++ ) { + console.log(myArray[i]); +} diff --git a/exercises/06.2-Loop-from-the-top/app.js b/exercises/06.2-Loop-from-the-top/app.js index 79b11d5c..ab7f0c6b 100644 --- a/exercises/06.2-Loop-from-the-top/app.js +++ b/exercises/06.2-Loop-from-the-top/app.js @@ -1,7 +1,6 @@ let mySampleArray = [3423,5,4,47889,654,8,867543,23,48,56432,55,23,25,12]; -for(let i = 0; i-1; i--) { console.log(mySampleArray[i]); } \ No newline at end of file diff --git a/exercises/06.3-Loop-adding-two/app.js b/exercises/06.3-Loop-adding-two/app.js index 79b11d5c..51e9c674 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 -1; i--) { + console.log(mySampleArray[i]); +} \ 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 7c498a2b..8ae613ca 100644 --- a/exercises/07.1-Finding-Waldo/app.js +++ b/exercises/07.1-Finding-Waldo/app.js @@ -1,3 +1,8 @@ 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 the if conditionals \ No newline at end of file +//loop here to find waldo, use the if conditionals +for (let i = 0; i < people.length; i++) { + if (people[i].toLowerCase() == 'waldo'){ + console.log(i); + }; +} \ No newline at end of file diff --git a/exercises/07.2-Letter-Counter/app.js b/exercises/07.2-Letter-Counter/app.js index ea913651..fd907596 100644 --- a/exercises/07.2-Letter-Counter/app.js +++ b/exercises/07.2-Letter-Counter/app.js @@ -2,5 +2,17 @@ let par = "Lorem ipsum dolor sit amet consectetur adipiscing elit Curabitur eget let counts = {}; // your code here +for (let i in par) { + let letter = par[i].toLowerCase(); + if (letter == " ") { + continue; + } + else if (counts[letter] == undefined) { + counts[letter] = 1; + } + else { + counts[letter] += 1; + } +} console.log(counts); \ No newline at end of file diff --git a/exercises/07.3-Flip-Array/app.js b/exercises/07.3-Flip-Array/app.js index 4876d9ad..08b58bcc 100644 --- a/exercises/07.3-Flip-Array/app.js +++ b/exercises/07.3-Flip-Array/app.js @@ -1,3 +1,24 @@ let arr = [45,67,87,23,5,32,60]; //Your code here. +// newArr = []; +// for (let i in arr) { +// newArr.unshift(arr[i]); +// } + + +// newArr = []; +// for (let i = arr.length-1; i >- 1; i--) { +// newArr.push(arr[i]); +// // console.log(arr[i]); +// } + +// console.log(newArr); + + +let flippedArray = [] +for(let i = arr.length - 1; i>= 0;i--){ + let item = arr[i]; + flippedArray.push(item); +} +console.log(flippedArray) \ No newline at end of file diff --git a/exercises/08.1-Mixed-array/app.js b/exercises/08.1-Mixed-array/app.js index fc215a43..6c8f2671 100644 --- a/exercises/08.1-Mixed-array/app.js +++ b/exercises/08.1-Mixed-array/app.js @@ -1,3 +1,10 @@ let mix = [42, true, "towel", [2,1], 'hello', 34.4, {"name": "juan"}]; -//your code here \ No newline at end of file +//your code here +let arrayOfTypes = []; +for (let i in mix) { + // console.log(typeof(mix[i])); + arrayOfTypes.push(typeof(mix[i])); +} + +console.log(arrayOfTypes); \ 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 30e7a6c5..217f3160 100644 --- a/exercises/08.2-Count-On/app.js +++ b/exercises/08.2-Count-On/app.js @@ -4,6 +4,14 @@ let hello = []; for(let index = 0; index < myArray.length; index++){ let element = myArray[index]; // MAGIC HAPPENS HERE + if (typeof(element) != 'object') { + continue; + } + else { + hello.push(element); + } + + } -console.log(hello) \ No newline at end of file +console.log(hello) \ No newline at end of file diff --git a/exercises/08.3-Sum-all-items/app.js b/exercises/08.3-Sum-all-items/app.js index 3e25668e..102d7d01 100644 --- a/exercises/08.3-Sum-all-items/app.js +++ b/exercises/08.3-Sum-all-items/app.js @@ -1,6 +1,12 @@ function sumTheElements(theArray){ let total = 0; //your code here - + for (let i in theArray) { + total += theArray[i]; + } return total; -} \ No newline at end of file +} + + +console.log(sumTheElements([2,13,34,5])) + diff --git a/exercises/09-forEach-loop/app.js b/exercises/09-forEach-loop/app.js index 51475751..42a188d5 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 - console.log(item); + if (item % 14 == 0) { + console.log(item); + } }); \ No newline at end of file diff --git a/exercises/10-Everything-is-awesome/app.js b/exercises/10-Everything-is-awesome/app.js index 11f447a4..b5633d7f 100644 --- a/exercises/10-Everything-is-awesome/app.js +++ b/exercises/10-Everything-is-awesome/app.js @@ -4,6 +4,13 @@ const ZerosToYahoos = (arr) => { let return_array = []; arr.forEach((item,index) => { // magic goes inside these brackets + console.log(item); + if (item == 1) { + return_array.push(item); + } + else if (item == 0) { + return_array.push("Yahoo"); + } }); return return_array; }; diff --git a/exercises/11-Do-while/app.js b/exercises/11-Do-while/app.js index 0db3f713..ff283612 100644 --- a/exercises/11-Do-while/app.js +++ b/exercises/11-Do-while/app.js @@ -2,6 +2,11 @@ let i = 20; do { // Magic goes here; + if (i % 5 == 0) { + console.log(i+"!"); + } else { + console.log(i); + } i--; +} while (i >= 1); - i--; -} while (i > 0); \ No newline at end of file +console.log("LIFTOFF"); \ No newline at end of file diff --git a/exercises/12-Delete-element/app.js b/exercises/12-Delete-element/app.js index 1bdb10ab..2093306e 100644 --- a/exercises/12-Delete-element/app.js +++ b/exercises/12-Delete-element/app.js @@ -1,6 +1,10 @@ let people = ['juan','ana','michelle','daniella','stefany','lucy','barak', 'emilio']; //your code below +function deletePerson(nameOfPerson) { + let deleteArray = people.filter((x) => x != nameOfPerson); + return deleteArray +} console.log(deletePerson('daniella')); console.log(deletePerson('juan'));