From 3adefe4e4a07a6f5c0e78cc6733bb2977446afd4 Mon Sep 17 00:00:00 2001 From: Bryant Ferguson Date: Tue, 31 Mar 2026 11:50:45 -0400 Subject: [PATCH 1/3] finished project --- bryantferguson/src/js-data-types-lab/lab.js | 143 ++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 bryantferguson/src/js-data-types-lab/lab.js diff --git a/bryantferguson/src/js-data-types-lab/lab.js b/bryantferguson/src/js-data-types-lab/lab.js new file mode 100644 index 0000000..8625ca6 --- /dev/null +++ b/bryantferguson/src/js-data-types-lab/lab.js @@ -0,0 +1,143 @@ +// Practice 1 +let fullName = "Bryant Ferguson" +console.log(fullName.length); +console.log(fullName.toUpperCase()); +console.log(fullName.includes("Ferguson")); +let firstName = fullName.split(" "); +console.log(firstName[0]); + +// Practice 1 Mini Challenge +function helloName(name) { + return "Hello, " + name + "!"; +} + +helloName("Bryant"); + +// .length gets the length of string or an array +// .includes() returns a boolean on whether a certain value is in a string +// .slice() returns a portion of a string based on the substring range + +// Practice 2 + +let num1 = 10; +let num2 = 3; + +console.log(num1 + num2); // addition +console.log(num1 - num2 ); // subtraction +console.log(num1 * num2); // multiplication +console.log(num1 / num2 ); // division +console.log(num1 % num2); // remainder +let num = Math.floor(Math.random() * 10) + 1; +console.log("random num " + num); + +function evenOrOdd(number){ + if(number % 2 == 0){ + return true; + } + return false; +} + +console.log(evenOrOdd(11)); + +//% is the remainder after the dvision +//math random returns a random number based on the name +//math floor rounds a number down to the nearest whole number + +// Practice 3 +let students = ["A", "B", "C", "D"]; +for(let i=0; i= 90) { + return "A"; + } else if (average >= 80) { + return "B"; + } else if (average >= 70) { + return "C"; + } else if (average >= 60) { + return "D"; + } else { + return "F"; + } +} + +// FIXED: use the correct function names (your logic kept the same) +let average = calculateAverage(student.scores); +let grade = getFinalGrades(average); + +console.log("Name: " + student.name); +console.log("Average: " + average); +console.log("Grade: " + grade); \ No newline at end of file From a0f38facbcff13f608c5e2aacf34b4060158fcb6 Mon Sep 17 00:00:00 2001 From: Bryant Ferguson Date: Tue, 31 Mar 2026 11:53:21 -0400 Subject: [PATCH 2/3] Fixed minor change --- bryantferguson/src/js-data-types-lab/lab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/bryantferguson/src/js-data-types-lab/lab.js b/bryantferguson/src/js-data-types-lab/lab.js index 8625ca6..3eabf1f 100644 --- a/bryantferguson/src/js-data-types-lab/lab.js +++ b/bryantferguson/src/js-data-types-lab/lab.js @@ -134,7 +134,6 @@ function getFinalGrades(average) { } } -// FIXED: use the correct function names (your logic kept the same) let average = calculateAverage(student.scores); let grade = getFinalGrades(average); From 87abc60200b67543ce28c0427cb1deaa76faa783 Mon Sep 17 00:00:00 2001 From: Bryant Ferguson Date: Tue, 31 Mar 2026 11:56:51 -0400 Subject: [PATCH 3/3] Added reflection questions --- bryantferguson/src/js-data-types-lab/lab.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bryantferguson/src/js-data-types-lab/lab.js b/bryantferguson/src/js-data-types-lab/lab.js index 3eabf1f..af80584 100644 --- a/bryantferguson/src/js-data-types-lab/lab.js +++ b/bryantferguson/src/js-data-types-lab/lab.js @@ -139,4 +139,9 @@ let grade = getFinalGrades(average); console.log("Name: " + student.name); console.log("Average: " + average); -console.log("Grade: " + grade); \ No newline at end of file +console.log("Grade: " + grade); + +//Strings are the easiest data type for me +//Arrays are the most confusing for me +//Arrays are collection of values of the same data type, objects have multiple different fields that can be different data types +// You would use arrays when grouping data of the same type, you would objects when grouping data with mutiple different fields that need to be grouped together