Skip to content
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
4d9dd8f
Data and Variables Exercise done
wisevaishu Jan 8, 2024
f205350
Booleans and Conditional exercise completed
wisevaishu Jan 10, 2024
e0f1133
Errors and Debugging Exercise done
wisevaishu Jan 11, 2024
08cd5c2
Booleans and Conditional Studio Completed
wisevaishu Jan 12, 2024
847d40f
Stringing Characters Together Excercises Completed
wisevaishu Jan 16, 2024
aace39a
Strings Exercise Completed
wisevaishu Jan 17, 2024
8fe0073
class 3 studio completed
wisevaishu Jan 19, 2024
7fb8c44
loops exercises completed
wisevaishu Jan 22, 2024
bcb2288
While Loop Exercise Modified
wisevaishu Jan 23, 2024
bec1baa
loop studio done
wisevaishu Jan 23, 2024
172a520
Function Exercise Completed
wisevaishu Jan 24, 2024
7c260ed
Adding Workings while reading
wisevaishu Jan 24, 2024
ea380ac
Functions Studio Done
wisevaishu Jan 26, 2024
7559891
More on Functions Exercises Completed
wisevaishu Jan 29, 2024
833b994
try out in objects and math
wisevaishu Jan 29, 2024
d9bda67
More On Functions Studio Done
wisevaishu Jan 30, 2024
a78edfb
Object and Math Exercise completed
wisevaishu Jan 30, 2024
1b4f1d0
Object and Math Studio Completed
wisevaishu Feb 2, 2024
65839d4
Modules Exercise done
wisevaishu Feb 2, 2024
9d9d73a
unit test exercise completed
wisevaishu Feb 7, 2024
a271c16
Exceptions Exercise completed
wisevaishu Feb 9, 2024
2ebdffd
unit testing studio done
wisevaishu Feb 9, 2024
0c82601
class exercise completed
wisevaishu Feb 9, 2024
bdb1386
classes studio completed
wisevaishu Feb 9, 2024
b35860a
HTML Exercise Completed
wisevaishu Feb 14, 2024
0c662ba
classes studio completed
wisevaishu Feb 16, 2024
ec2fd95
Css exercise completed
wisevaishu Feb 21, 2024
b6e5ce0
Dom Exercise completed
wisevaishu Feb 26, 2024
260777d
dom and events studio completed
wisevaishu Feb 27, 2024
f7b1220
up down left right button modification
wisevaishu Feb 29, 2024
efcd1f3
user input with forms exercise completed
wisevaishu Feb 29, 2024
f6bc67c
studio user input with forms completed
wisevaishu Mar 1, 2024
440f68b
fetch exercise completed
wisevaishu Mar 1, 2024
873ee98
fetch studio completed
wisevaishu Mar 2, 2024
11256e1
studio fetch done
wisevaishu Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
**/node_modules
11 changes: 11 additions & 0 deletions arrays/exercises/part-five-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ 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(''));

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

//3) Do split or join change the original string/array?

console.log(str.split(' '));
console.log(arr.join("|"));

//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";

console.log(cargoHold.split(',').sort().join(','));
18 changes: 15 additions & 3 deletions arrays/exercises/part-four-arrays.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
let holdCabinet1 = ['duct tape', 'gum', 3.14, false, 6.022e23];
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.
//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.
//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.splice(0,2));
console.log(holdCabinet1);

//3) reverse the first array, and sort the second. What is the difference between these two methods? Do the methods alter the original arrays?
//3) reverse the first array, and sort the second. What is the difference between these
//two methods? Do the methods alter the original arrays?
holdCabinet1.reverse();
console.log(holdCabinet1);
holdCabinet2.sort();
console.log(holdCabinet2);
6 changes: 6 additions & 0 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];
practiceFile.push(42, "hello");
console.log(practiceFile);
practiceFile.push(false, -4.6, "87");
console.log(practiceFile);

//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.

//Use a single .push() to add the following items: false, -4.6, and "87". Print the array to confirm the changes.
37 changes: 29 additions & 8 deletions arrays/exercises/part-six-arrays.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
//Arrays can hold different data types, even other arrays! A multi-dimensional array is one with entries that are themselves arrays.
//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.
//1) Define and initialize the arrays specified in the exercise to hold the name, c
//hemical 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.
//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, element2, 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[0]);
console.log(table[0][2]);

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

//4) Using bracket notation and the table array, print the mass of element1, the name for element 2 and the symbol for element26.

//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.
//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("Mass of " +table[0][0] + ": " + table[0][2]);
console.log("Name of Element 2 : " +table[1][0]);
console.log(`Symbol for ${table[2][0]} 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.
var myArr = new Array();
myArr.push(["Element1", table[0]]);
myArr.push("Elements2", table[1]);
myArr.push("Elements3", table[2]);
console.log(myArr[0][0] + " : " + myArr[0][1]);
18 changes: 15 additions & 3 deletions arrays/exercises/part-three-arrays.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
let cargoHold = [1138, 'space suits', 'parrot', 'instruction manual', 'meal packs', 'space tether', '20 meters'];
let cargoHold = [1138, 'space suits', 'parrot', 'instruction manual', 'meal packs',
'space tether', '20 meters'];

//Use splice to make the following changes to the cargoHold array. Be sure to print the array after each step to confirm your updates.
//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).
//2) Remove ‘instruction manual’ from the array. (Hint: indexOf is helpful to avoid
//manually counting an index).
if (cargoHold.indexOf("instruction manual") > -1)
{
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’.
let temp = [cargoHold.splice(2,3,'cat','fob','string cheese')];
console.log(cargoHold);
26 changes: 21 additions & 5 deletions arrays/exercises/part-two-arrays.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
let cargoHold = ['oxygen tanks', 'space suits', 'parrot', 'instruction manual', 'meal packs', 'slinky', 'security blanket'];
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.
//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.
//2) Remove the last item from the array with pop. Print the element removed and the
//updated array.
let last_element_array = cargoHold.pop();
console.log(last_element_array);

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

//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.
//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.push("20 meters");
cargoHold.unshift(1138);
console.log(cargoHold);

//5) Use a template literal to print the final array and its length.
console.log(`The length of the ${cargoHold} is ${cargoHold.length}.`)
50 changes: 33 additions & 17 deletions arrays/studio/array-string-conversion/array-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,60 @@ let protoArray2 = "A;C;M;E";
let protoArray3 = "space delimited string";
let protoArray4 = "Comma-spaces, might, require, typing, caution";

strings = [protoArray1, protoArray2, protoArray3, protoArray4];
let strings = [protoArray1, protoArray2, protoArray3, protoArray4];

//2)
function reverseCommas() {
function reverseCommas()
{
//TODO: 1. create and instantiate your variables.
let check;
let check=strings[0].includes(",");
let output;
//TODO: 2. write the code required for this step

//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 { }.
if (check)
{
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;
function semiDash()
{
let check=strings[1];
let output;
//TODO: write the code required for this step


//TODO: write the code required for this step
if (check)
{
output = check.split(";").reverse().sort().join("-");
}
return output;
}


//4)
function reverseSpaces() {
let check;
function reverseSpaces()
{
let check=strings[2];
let output;
//TODO: write the code required for this step

//TODO: write the code required for this step
if (check)
{
output = check.split(" ").sort().reverse().join(" ");
}
return output;
}

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

//TODO: write the code required for this step
if (check)
{
output = check.split(", ").sort().reverse().join(",");
}
return output;
}

Expand Down
71 changes: 67 additions & 4 deletions arrays/studio/multi-dimensional-arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,75 @@ let equipment = "space suits,jet packs,tool belts,thermal detonators";
let pets = "parrots,cats,moose,alien eggs";
let sleepAids = "blankets,pillows,eyepatches,alarm clocks";

//1) Use split to convert the strings into four cabinet arrays. Alphabetize the contents of each cabinet.
//1) Use split to convert the strings into four cabinet arrays.
//Alphabetize the contents of each cabinet.
let cabinet1=food.split(",").sort();
console.log(cabinet1);
let cabinet2=equipment.split(",").sort();
console.log(cabinet2);
let cabinet3=pets.split(",").sort();
console.log(cabinet3);
let cabinet4=sleepAids.split(",").sort();
console.log(cabinet4);

//2) Initialize a cargoHold array and add the cabinet arrays to it. Print cargoHold to verify its structure.

//2) Initialize a cargoHold array and add the cabinet arrays to it.
//Print cargoHold to verify its structure.
let cargoHold = [cabinet1,cabinet2, cabinet3, cabinet4];
console.log(cargoHold);

//3) Query the user to select a cabinet (0 - 3) in the cargoHold.

//4) Use bracket notation and a template literal to display the contents of the selected cabinet. If the user entered an invalid number, print an error message.
let input = require('readline-sync');
let cabinetNumber=input.question("Please Enter Cabinet Number : ");

//4) Use bracket notation and a template literal to display the contents of the
//selected cabinet. If the user entered an invalid number, print an error message.

if (cabinetNumber>cargoHold.length)
{
console.log("Please enter Correct Cabinet Number (1-4)");
}
else if (cabinetNumber===0)
{
console.log("Please enter Correct Cabinet Number (1-4)");
}
else if (isNaN(cabinetNumber))
{
console.log("Please enter a Number");
}
else
{
console.log(`The Cabinet Details
${cargoHold[cabinetNumber-1]}`);
}

//5) Modify the code to query the user for BOTH a cabinet in cargoHold AND a particular item. Use the 'includes' method to check if the cabinet contains the selected item, then print “Cabinet ____ DOES/DOES NOT contain ____.”
//5) Modify the code to query the user for BOTH a cabinet in cargoHold AND a particular
//item. Use the 'includes' method to check if the cabinet contains the selected item,
//then print “Cabinet ____ DOES/DOES NOT contain ____.”
let cabinetNumber1 = input.question("Please Enter Cabinet Number : ");
let Item_Name = input.question("Please Enter Item Name : ");
if (cabinetNumber1>cargoHold.length)
{
console.log("Please enter Correct Cabinet Number (1-4)");
}
else if (cabinetNumber1===0)
{
console.log("Please enter Correct Cabinet Number (1-4)");
}
else if (isNaN(cabinetNumber1))
{
console.log("Please enter a Number");
}
else if (typeof Item_Name === "number")
{
console.log("Please enter Item Name correctly");
}
else
{
if (cargoHold[cabinetNumber1-1].includes(Item_Name)) {
console.log(`Cabinet ${cabinetNumber1} contains ${Item_Name}.`);
} else {
console.log(`Cabinet ${cabinetNumber1} does not contain ${Item_Name}.`);
}
}
20 changes: 20 additions & 0 deletions arrays/studio/package-lock.json

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

30 changes: 24 additions & 6 deletions arrays/studio/string-modification.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
const input = require('readline-sync');
let str = "LaunchCode";
//string modifications


//1) Use string methods to remove the first three characters from the string and add them to the end.
//Hint - define another variable to hold the new string or reassign the new string to str.
let str = "LaunchCode";

//1) Use string methods to remove the first three characters from the string and add them to the
//end. //Hint - define another variable to hold the new string or reassign the new string to str.
//Use a template literal to print the original and modified string in a descriptive phrase.
let first_three_character = str.substring(0,3);
//console.log(first_three_character);
console.log(`The First three characters of ${str} is added at end : ${str.replace(first_three_character, "")}${str.substring(0,3)}`);

//2) Modify your code to accept user input. Query the user to enter the number of letters
//that will be relocated.
const input = require('readline-sync');
let noToRelocate = input.question("Enter Number of Letters to relocate : ");

//2) Modify your code to accept user input. Query the user to enter the number of letters that will be relocated.
//3) Add validation to your code to deal with user inputs that are longer than the word.
//In such cases, default to moving 3 characters. Also, the template literal should note the error.
if (noToRelocate>str.length)
{
console.log("Please give a number less than the String's(" +str+ ") Length");
console.log(`Default Moving 3 Characters : ${str.replace(first_three_character, "")}${str.substring(0,3)}`);
}
else
{
console.log(`${str.replace(str.substring(0, noToRelocate), "")}${str.substring(0,noToRelocate)}`);
}

//3) Add validation to your code to deal with user inputs that are longer than the word. In such cases, default to moving 3 characters. Also, the template literal should note the error.
Loading