Skip to content

Finished Loop exercises #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
53cf0a4
completed data and variables assignment
jefferycphipps Jun 11, 2024
d774f05
new file: data-and-variables/chapter-examples/type-of.js
jefferycphipps Jun 11, 2024
7cc390b
completed exercises
jefferycphipps Jun 11, 2024
9c1f067
changed part 1.js
jefferycphipps Jun 17, 2024
49d1c34
changed part 2.js
jefferycphipps Jun 17, 2024
43fce7f
changed part 2 and 3
jefferycphipps Jun 17, 2024
b4d33fa
Finished Debugging problems
jefferycphipps Jun 17, 2024
da06984
Finished Shuttle Launch
jefferycphipps Jun 18, 2024
3d184c1
Finished parts 1 2 and 3
jefferycphipps Jun 20, 2024
e08b4a4
Arrays exercises done
jefferycphipps Jun 20, 2024
f3a0b9c
Finished Array studio
jefferycphipps Jun 21, 2024
619f35a
Completed Multi-dimensional arrays.
jefferycphipps Jun 21, 2024
f52a01c
Finished Loop exercises
jefferycphipps Jun 24, 2024
546ed62
Loop Studio Complete with Bonus finished as well
jefferycphipps Jun 24, 2024
81616c5
Exercises added with Bonus done
jefferycphipps Jun 26, 2024
9b45527
Finished Studio work
jefferycphipps Jun 27, 2024
8e5b456
Updated changes
jefferycphipps Jun 27, 2024
8826d4a
finished studio
jefferycphipps Jun 28, 2024
c2eb45b
Completed More Functions exercises
jefferycphipps Jul 1, 2024
779d7eb
Chapter exercises done
jefferycphipps Jul 1, 2024
5331890
"changed exercises in functions"
jefferycphipps Jul 1, 2024
b2411d2
Finished Studio
jefferycphipps Jul 2, 2024
c38dde3
Finished Objects and Math exercises
jefferycphipps Jul 8, 2024
73a0553
Uploading some chapter examples
jefferycphipps Jul 8, 2024
54da233
Finished Object Studio problems
jefferycphipps Jul 9, 2024
3a431cd
Completed bonus missions
jefferycphipps Jul 9, 2024
7c51af3
Finished exercises
jefferycphipps Jul 11, 2024
0c70323
10k changes
jefferycphipps Jul 15, 2024
18d5516
Class exercises done
jefferycphipps Jul 15, 2024
e58c662
"installed jest"
jefferycphipps Jul 15, 2024
c63c356
Finished exercises with bonus
jefferycphipps Jul 15, 2024
b0f1551
Finsished Studio
jefferycphipps Jul 16, 2024
471f5bd
chapter example done
jefferycphipps Jul 18, 2024
96de473
chpater exercises done
jefferycphipps Jul 18, 2024
e454299
Completed exercises
jefferycphipps Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
14 changes: 12 additions & 2 deletions arrays/exercises/part-five-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ let str = 'In space, no one can hear you code.';
let arr = ['B', 'n', 'n', 5];

//1) Use the split method on the string to identify the purpose of the parameter inside the ().

console.log(str.split());
console.log(str.split("e"));
console.log(str.split(" "));
console.log(str.split(""));
console.log(str);
//2) Use the join method on the array to identify the purpose of the parameter inside the ().

console.log(arr.join());
console.log(arr.join("a"));
console.log(arr.join( " "));
console.log(arr.join(""));
console.log(arr);
//3) Do split or join change the original string/array?

//4) We can take a comma-separated string and convert it into a modifiable array. Try it! Alphabetize the cargoHold string, and then combine the contents into a new string.
let cargoHold = "water,space suits,food,plasma sword,batteries";
let newcargoHold = cargoHold.split(",").sort().join(",");
console.log(newcargoHold);
13 changes: 11 additions & 2 deletions arrays/exercises/part-four-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ let holdCabinet2 = ['orange drink', 'nerf toys', 'camera', 42, 'parsnip'];
//Explore the methods concat, slice, reverse, and sort to determine which ones alter the original array.

//1) Print the result of using concat on the two arrays. Does concat alter the original arrays? Verify this by printing holdCabinet1 after using the method.

console.log(holdCabinet1.concat(holdCabinet2));
console.log(holdCabinet1);
//2) Print a slice of two elements from each array. Does slice alter the original arrays?
console.log(holdCabinet1.slice(2,3));
console.log(holdCabinet2.slice(1,3));
console.log(holdCabinet1);
console.log(holdCabinet2);
//3) reverse the first array, and sort the second. What is the difference between these two methods? Do the methods alter the original arrays?
console.log(holdCabinet1.reverse());
console.log(holdCabinet2.sort());

//3) reverse the first array, and sort the second. What is the difference between these two methods? Do the methods alter the original arrays?
console.log(holdCabinet1);
console.log(holdCabinet2);
10 changes: 8 additions & 2 deletions arrays/exercises/part-one-arrays.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
//Create an array called practiceFile with the following entry: 273.15

let practiceFile = [273.15];
//Use the bracket notation method to add "42" and "hello" to the array. Add these new items one at a time. Print the array after each step to confirm the changes.

practiceFile[1] = "42";
console.log(practiceFile);
practiceFile[2] = "hello";
console.log(practiceFile);
//Use a single .push() to add the following items: false, -4.6, and "87". Print the array to confirm the changes.

practiceFile.push(false, -4.6, "87");
console.log(practiceFile);
23 changes: 20 additions & 3 deletions arrays/exercises/part-six-arrays.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
//Arrays can hold different data types, even other arrays! A multi-dimensional array is one with entries that are themselves arrays.

//1) Define and initialize the arrays specified in the exercise to hold the name, chemical symbol and mass for different elements.

let element1 = ['hydrogen', 'H', 1.008];
let element2 = ['helium', 'He', 4.003];
let element26 = ['iron', 'Fe', 55.85];
//2) Define the array 'table', and use 'push' to add each of the element arrays to it. Print 'table' to see its structure.
let table = [];
table.push(element1);
table.push(element2);
table.push(element26);

console.log(table);
//3) Use bracket notation to examine the difference between printing 'table' with one index vs. two indices (table[][]).

console.log(table[1]);
console.log(table[1][1]);
//4) Using bracket notation and the table array, print the mass of element1, the name for element 2 and the symbol for element26.

console.log("The mass of element1 is " + table[0][2] + ". The name of element2 is " + table[1][0] + ". The symbol for element26 is " + table[2][1]);
//5) 'table' is an example of a 2-dimensional array. The first “level” contains the element arrays, and the second level holds the name/symbol/mass values. Experiment! Create a 3-dimensional array and print out one entry from each level in the array.
let threeD = [];
threeD.push([1,2,3]);
threeD.push([4,5,6]);
threeD.push([7,8,9]);

console.log(threeD);
console.log(threeD[0][1]);
console.log(threeD[1][1]);
console.log(threeD[2][2]);
8 changes: 6 additions & 2 deletions arrays/exercises/part-three-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ let cargoHold = [1138, 'space suits', 'parrot', 'instruction manual', 'meal pack
//Use splice to make the following changes to the cargoHold array. Be sure to print the array after each step to confirm your updates.

//1) Insert the string 'keys' at index 3 without replacing any other entries.

cargoHold.splice(3, 0, "keys");
console.log(cargoHold);
//2) Remove ‘instruction manual’ from the array. (Hint: indexOf is helpful to avoid manually counting an index).

cargoHold.splice(cargoHold.indexOf("instruction manual"),1);
console.log(cargoHold);
//3) Replace the elements at indexes 2 - 4 with the items ‘cat’, ‘fob’, and ‘string cheese’.
cargoHold.splice(2,3, "cat","fob","string cheese");
console.log(cargoHold);
14 changes: 10 additions & 4 deletions arrays/exercises/part-two-arrays.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
let cargoHold = ['oxygen tanks', 'space suits', 'parrot', 'instruction manual', 'meal packs', 'slinky', 'security blanket'];

//1) Use bracket notation to replace ‘slinky’ with ‘space tether’. Print the array to confirm the change.

cargoHold[5] = 'space tether';
console.log(cargoHold);
//2) Remove the last item from the array with pop. Print the element removed and the updated array.

console.log(cargoHold.pop());
console.log(cargoHold);
//3) Remove the first item from the array with shift. Print the element removed and the updated array.

console.log(cargoHold.shift());
console.log(cargoHold);
//4) Unlike pop and shift, push and unshift require arguments inside the (). Add the items 1138 and ‘20 meters’ to the the array - the number at the start and the string at the end. Print the updated array to confirm the changes.

cargoHold.unshift(1138);
cargoHold.push("20 Meters");
console.log(cargoHold);
//5) Use a template literal to print the final array and its length.
console.log('The final array is ' + cargoHold + 'and its length is ' + cargoHold.length);
38 changes: 27 additions & 11 deletions arrays/studio/array-string-conversion/array-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,55 @@ strings = [protoArray1, protoArray2, protoArray3, protoArray4];
//2)
function reverseCommas() {
//TODO: 1. create and instantiate your variables.
let check;
let output;
let check = strings[0];
let output = [];
//TODO: 2. write the code required for this step

if(check.includes(",")){
output = strings[0].split(",").reverse().join(",");
}
//NOTE: For the code to run properly, you must return your output. this needs to be the final line of code within the function's { }.
return output;
}

//3)
function semiDash() {
let check;
let output;
let check = strings[1];
let output = [];
//TODO: write the code required for this step
if(check.includes(";")){
output = strings[1].split(";").sort().join("-");
}


return output;
}

//4)
function reverseSpaces() {
let check;
let output;
//TODO: write the code required for this step
let check = strings[2];
let output = [];
//TODO: write the code required for this step
if(check.includes(" ")){
output = strings[2].split(" ").sort().reverse().join(" ");
}

return output;
}

//5)
function commaSpace() {
let check;
let output;
let check = strings[3];
let output = [];
//TODO: write the code required for this step

if(check.includes(",")){
let temp = strings[3].split(",");
temp[0]= temp[0].trim();
temp[1]= temp[1].trim();
temp[2]= temp[2].trim();
temp[3]= temp[3].trim();
temp[4]= temp[4].trim();
output = temp.reverse().join(",");
}
return output;
}

Expand Down
16 changes: 16 additions & 0 deletions arrays/studio/array-string-conversion/node_modules/.bin/acorn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions arrays/studio/array-string-conversion/node_modules/.bin/acorn.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions arrays/studio/array-string-conversion/node_modules/.bin/acorn.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading