From 8cc92d0bd494f33e734436fd3cc8018833c8b792 Mon Sep 17 00:00:00 2001
From: AmiyahJo <86239804+AmiyahJo@users.noreply.github.com>
Date: Tue, 24 Sep 2024 15:05:50 -0400
Subject: [PATCH 01/20] Create README.md
Accidentally removed my work the 1st time by merging
---
lesson_00/amiyahjones/README.md | 43 +++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 lesson_00/amiyahjones/README.md
diff --git a/lesson_00/amiyahjones/README.md b/lesson_00/amiyahjones/README.md
new file mode 100644
index 000000000..14fc62d70
--- /dev/null
+++ b/lesson_00/amiyahjones/README.md
@@ -0,0 +1,43 @@
+# Mya.README
+ ```Javascript
+const Mya = class SoftwareEngineer {
+ intern(code, tools) {
+ self.code = Javascript, HTML, CSS, Java;
+ self.tools = React, Docker;
+ }
+};
+
+// Intrested in bringing ideas to life within a web browser.
+// Learning how websites become quick, responsive, and accesssible to everyone.
+```
+
+
+
+### ☴ My work hours
+9AM-5PM I'm an early bird and often begin the day with a head start of my work. Feel free to reach me by email during this time, and I'll get back to you as soon as I'm able!
+
+### What's the best way to communicate with me? .☘︎ ݁˖
+Private message through google chat works perfectly. Email works too as a follow up or if I happened to miss one of your messages.
+> [!TIP]
+> _In case I don't respond:_ Ping me again on google chat or send me another email!
+
+### I'd be happy to help you with ꒰ ﹍ ꒱
+* Code suggestions
+* Explain or understand a code snippet
+* Photos + design ideas
+
+## Extra ⓘ
+* ✦ procreate artist ↓
+ - I like to combine my art and code together!
+ - In case you find me with my ipad, that's why
+* visual learner
+* Jr Developer HS Intern for 4 years with Code Differently (youth program)
+* No, I don't drink coffee. ~~Hot chocolate is my go to~~
+
+> I'm the type of person that if you ask me a question and I don't know the answer, I'm gonna tell you that I don't know. But I bet you what, I know how to find the answer and I will find the answer.
- Will smith
+
+
+###### // readme inspired by [Kaeti's repo][kaeti-repo] , code snippet inspired by [Thai Brega]
+
+[kaeti-repo]: https://github.com/kaeti/personal-readme
+[Thai brega]: https://github.com/Thaiane/Thaiane
From 50b18619d9de9203384f678c1e0eee84a70510a0 Mon Sep 17 00:00:00 2001
From: AmiyahJo <86239804+AmiyahJo@users.noreply.github.com>
Date: Tue, 24 Sep 2024 15:07:22 -0400
Subject: [PATCH 02/20] Delete lesson_00/amiyahjones/README.md
---
lesson_00/amiyahjones/README.md | 43 ---------------------------------
1 file changed, 43 deletions(-)
delete mode 100644 lesson_00/amiyahjones/README.md
diff --git a/lesson_00/amiyahjones/README.md b/lesson_00/amiyahjones/README.md
deleted file mode 100644
index 14fc62d70..000000000
--- a/lesson_00/amiyahjones/README.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Mya.README
- ```Javascript
-const Mya = class SoftwareEngineer {
- intern(code, tools) {
- self.code = Javascript, HTML, CSS, Java;
- self.tools = React, Docker;
- }
-};
-
-// Intrested in bringing ideas to life within a web browser.
-// Learning how websites become quick, responsive, and accesssible to everyone.
-```
-
-
-
-### ☴ My work hours
-9AM-5PM I'm an early bird and often begin the day with a head start of my work. Feel free to reach me by email during this time, and I'll get back to you as soon as I'm able!
-
-### What's the best way to communicate with me? .☘︎ ݁˖
-Private message through google chat works perfectly. Email works too as a follow up or if I happened to miss one of your messages.
-> [!TIP]
-> _In case I don't respond:_ Ping me again on google chat or send me another email!
-
-### I'd be happy to help you with ꒰ ﹍ ꒱
-* Code suggestions
-* Explain or understand a code snippet
-* Photos + design ideas
-
-## Extra ⓘ
-* ✦ procreate artist ↓
- - I like to combine my art and code together!
- - In case you find me with my ipad, that's why
-* visual learner
-* Jr Developer HS Intern for 4 years with Code Differently (youth program)
-* No, I don't drink coffee. ~~Hot chocolate is my go to~~
-
-> I'm the type of person that if you ask me a question and I don't know the answer, I'm gonna tell you that I don't know. But I bet you what, I know how to find the answer and I will find the answer.
- Will smith
-
-
-###### // readme inspired by [Kaeti's repo][kaeti-repo] , code snippet inspired by [Thai Brega]
-
-[kaeti-repo]: https://github.com/kaeti/personal-readme
-[Thai brega]: https://github.com/Thaiane/Thaiane
From b4ec39486d9c343460bbe44787ec63ba37b36798 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Wed, 9 Oct 2024 20:00:53 +0000
Subject: [PATCH 03/20] test: added the missing instructional test feat: began
creating an if statement for compareStrings
---
.../codedifferently-instructional/package-lock.json | 6 ++++++
lesson_07/conditionals/src/lesson7.ts | 4 +++-
.../codedifferently-instructional/package-lock.json | 6 ++++++
3 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 lesson_06/lib/typescript/codedifferently-instructional/package-lock.json
create mode 100644 lesson_07/lib/typescript/codedifferently-instructional/package-lock.json
diff --git a/lesson_06/lib/typescript/codedifferently-instructional/package-lock.json b/lesson_06/lib/typescript/codedifferently-instructional/package-lock.json
new file mode 100644
index 000000000..5dbe3fe98
--- /dev/null
+++ b/lesson_06/lib/typescript/codedifferently-instructional/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "codedifferently-instructional",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {}
+}
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 52f45df8b..1e92f6e52 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -23,7 +23,9 @@ export function compareStrings(a: string, b: string): number {
const distance = computeLexicographicDistance(a, b);
// TODO(you): Finish this method.
-
+ if (distance > 0){
+ return 1;
+ }
return 0;
}
diff --git a/lesson_07/lib/typescript/codedifferently-instructional/package-lock.json b/lesson_07/lib/typescript/codedifferently-instructional/package-lock.json
new file mode 100644
index 000000000..5dbe3fe98
--- /dev/null
+++ b/lesson_07/lib/typescript/codedifferently-instructional/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "codedifferently-instructional",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {}
+}
From 6fbcef59ffadc7ae520b85549f04cf15398db0bf Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Wed, 9 Oct 2024 20:03:56 +0000
Subject: [PATCH 04/20] feat: created a ` canVote ` if statement
---
lesson_07/conditionals/src/lesson7.ts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 1e92f6e52..58e96f540 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -7,6 +7,9 @@ import { computeLexicographicDistance } from "./util.js";
* @return True if the age corresponds to a voting age and false otherwise.
*/
export function canVote(age: number): boolean {
+ if (age >= 18){
+ return true;
+ }
return false;
}
From 58b7e17f5417094cad1a2315a0ee23d45b47e54e Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Wed, 9 Oct 2024 20:22:43 +0000
Subject: [PATCH 05/20] feat: if statements created for convertGpaToLetterGrade
---
lesson_07/conditionals/src/lesson7.ts | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 58e96f540..1f313e2d0 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -42,6 +42,27 @@ export function compareStrings(a: string, b: string): number {
* @return The letter grade ("A+", "A", "A-", "B+", etc.).
*/
export function convertGpaToLetterGrade(gpa: number): string {
+ if (gpa >= 4.0) {
+ return "A+";
+ } else if (gpa >= 3.7) {
+ return "A";
+ } else if (gpa >= 3.3) {
+ return "B+";
+ } else if (gpa >= 3.0) {
+ return "B";
+ } else if (gpa >= 2.7) {
+ return "B-";
+ } else if (gpa >= 2.3) {
+ return "C+";
+ } else if (gpa >= 2.0) {
+ return "C";
+ } else if (gpa >= 1.7) {
+ return "C-";
+ } else if (gpa >= 1.3) {
+ return "D+";
+ } else if (gpa >= 1.0) {
+ return "D";
+ }
return "F";
}
From 172ad2a5f40110089c18faf293cd1f02e2b9054d Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Wed, 9 Oct 2024 20:27:56 +0000
Subject: [PATCH 06/20] feat: add if statements to computeFactorial
---
lesson_07/conditionals/src/lesson7.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 1f313e2d0..ba9c3f82d 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -73,6 +73,11 @@ export function convertGpaToLetterGrade(gpa: number): string {
* @return The factorial of n.
*/
export function computeFactorial(n: number): number {
+ if (n < 0){
+ return -1
+ } else if (n === 0){
+ retrun 1;
+ }
return 0;
}
From d0e114da18a03ef24edaa96612a410fbdef939c4 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Wed, 9 Oct 2024 20:28:33 +0000
Subject: [PATCH 07/20] fix: changed spelling to 'return' from computeFactorial
---
lesson_07/conditionals/src/lesson7.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index ba9c3f82d..0fef0a262 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -76,7 +76,7 @@ export function computeFactorial(n: number): number {
if (n < 0){
return -1
} else if (n === 0){
- retrun 1;
+ return 1;
}
return 0;
}
From 722b6215b785b0aaed831ffacc1c9a8366c80c33 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Wed, 9 Oct 2024 20:45:38 +0000
Subject: [PATCH 08/20] feat: adjusting compareStrings statements
---
lesson_07/conditionals/src/lesson7.ts | 28 ++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 0fef0a262..6b0b42376 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -26,8 +26,10 @@ export function compareStrings(a: string, b: string): number {
const distance = computeLexicographicDistance(a, b);
// TODO(you): Finish this method.
- if (distance > 0){
+ if (a < b && distance > 0) {
return 1;
+ } else if (a > b) {
+ return -1;
}
return 0;
}
@@ -88,6 +90,9 @@ export function computeFactorial(n: number): number {
* @return The sum of all the values.
*/
export function addNumbers(values: number[]): number {
+ for (let i = 0; i < 9; i++){
+ console.log(values);
+ }
return 0;
}
@@ -98,6 +103,9 @@ export function addNumbers(values: number[]): number {
* @return An array containing the first `n` Fibonacci values.
*/
export function getFirstNFibonacciNumbers(n: number): number[] {
+ for (let i = 0; i < 9; i++) {
+ console.log(n);
+ }
return [];
}
@@ -124,10 +132,16 @@ export function binarySearch(
const pivotIndex = Math.floor((start + end) / 2); // The index in the middle of the array.
// TODO(you): Finish implementing this algorithm
-
- // If values[pivotIndex] is equal to value then return `pivotIndex`.
- // Else if values[pivotIndex] is greater than the value, then
- // call `binarySearch(values, start, pivotIndex - 1, value)` and return its value;
- // Else call `binarySearch(values, pivotIndex + 1, end, value)` and return its value.
- return -1;
+ if (pivotIndex === value) {
+ return pivotIndex;
+ } else if (pivotIndex > value){
+ return 0;
+ } else {
+ return 1;
+ }
+ // If values[pivotIndex] is equal to value then return `pivotIndex`.
+ // Else if values[pivotIndex] is greater than the value, then
+ // call `binarySearch(values, start, pivotIndex - 1, value)` and return its value;
+ // Else call `binarySearch(values, pivotIndex + 1, end, value)` and return its value.
+ return -1;
}
From 503ac6fe401e7a2cd1e840a4e59a01bb4028fb8f Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:05:10 +0000
Subject: [PATCH 09/20] fix: compareStrings if else statement changed from if(a
> b) to (distance > 0)
---
lesson_07/conditionals/src/lesson7.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 6b0b42376..4afc3bc88 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -26,9 +26,9 @@ export function compareStrings(a: string, b: string): number {
const distance = computeLexicographicDistance(a, b);
// TODO(you): Finish this method.
- if (a < b && distance > 0) {
+ if (distance < 0) {
return 1;
- } else if (a > b) {
+ } else if (distance > 0) {
return -1;
}
return 0;
From 1a2426a004ec693a8e60f355922e1eae4f1db2e1 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:06:46 +0000
Subject: [PATCH 10/20] fix: compareStrings return methods
---
lesson_07/conditionals/src/lesson7.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 4afc3bc88..7655d7cdd 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -27,9 +27,9 @@ export function compareStrings(a: string, b: string): number {
// TODO(you): Finish this method.
if (distance < 0) {
- return 1;
- } else if (distance > 0) {
return -1;
+ } else if (distance > 0) {
+ return 1;
}
return 0;
}
From 892656b1f7852ced0e59a0f006dfe6a522002f97 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:09:45 +0000
Subject: [PATCH 11/20] fix: convertGPAToLetterGrade fixed the expected return
methods from if statements 'gpa >=4.0' and 'gpa >= 3.7'
---
lesson_07/conditionals/src/lesson7.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 7655d7cdd..2a849445b 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -45,9 +45,9 @@ export function compareStrings(a: string, b: string): number {
*/
export function convertGpaToLetterGrade(gpa: number): string {
if (gpa >= 4.0) {
- return "A+";
- } else if (gpa >= 3.7) {
return "A";
+ } else if (gpa >= 3.7) {
+ return "A-";
} else if (gpa >= 3.3) {
return "B+";
} else if (gpa >= 3.0) {
From 114470233dfff2c45f317b6e2c628d7420f237fa Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:15:15 +0000
Subject: [PATCH 12/20] fix: created a for loop and a variable that holds the
factorial of n
---
lesson_07/conditionals/src/lesson7.ts | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 2a849445b..7264528f2 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -80,7 +80,12 @@ export function computeFactorial(n: number): number {
} else if (n === 0){
return 1;
}
- return 0;
+
+ let factorial = 1;
+ for (let i = 1; i <= n; i++){
+ factorial *= i;
+ }
+ return factorial;
}
/**
From 2c2a9bc0fdab994c7929de1bd9babdb33ca36eb6 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:19:30 +0000
Subject: [PATCH 13/20] fix: testAddNumbers
made sure the sum would be 0 so every value adds to the sum
---
lesson_07/conditionals/src/lesson7.ts | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 7264528f2..fd3330c7e 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -95,10 +95,12 @@ export function computeFactorial(n: number): number {
* @return The sum of all the values.
*/
export function addNumbers(values: number[]): number {
- for (let i = 0; i < 9; i++){
- console.log(values);
+ let sum = 0;
+ for (const value of values) {
+ sum += value;
}
- return 0;
+
+ return sum;
}
/**
From 8cd48322a87383d40408bf9b2c0b6ee847dd5473 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:44:35 +0000
Subject: [PATCH 14/20] fix: fibonacciNumbers made , and comments for
understanding
---
lesson_07/conditionals/src/lesson7.ts | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index fd3330c7e..97609b76f 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -76,7 +76,7 @@ export function convertGpaToLetterGrade(gpa: number): string {
*/
export function computeFactorial(n: number): number {
if (n < 0){
- return -1
+ return -1;
} else if (n === 0){
return 1;
}
@@ -99,7 +99,7 @@ export function addNumbers(values: number[]): number {
for (const value of values) {
sum += value;
}
-
+
return sum;
}
@@ -110,10 +110,20 @@ export function addNumbers(values: number[]): number {
* @return An array containing the first `n` Fibonacci values.
*/
export function getFirstNFibonacciNumbers(n: number): number[] {
- for (let i = 0; i < 9; i++) {
- console.log(n);
+ const fibonacciNumbers: number[] = new Array(n); //New empty array with a list of n
+
+ for (let i = 0; i < n; i++) {
+ if (i === 0){
+ fibonacciNumbers[i] = 1; //1st number is 1
+ } else if (i === 1){
+ fibonacciNumbers[i] = 1; //2nd number is also 1
+ } else {
+ fibonacciNumbers[i] = fibonacciNumbers[i - 1] + fibonacciNumbers[i - 2];
+ // current number = (previous number) + (number before that)
+ }
}
- return [];
+
+ return fibonacciNumbers;
}
/**
From 4a3d988d44744f69197c2ef46ad7b8b56a18e31d Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:52:38 +0000
Subject: [PATCH 15/20] fix: binarySearch function
---
lesson_07/conditionals/src/lesson7.ts | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 97609b76f..51dee46c2 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -136,10 +136,7 @@ export function getFirstNFibonacciNumbers(n: number): number[] {
* @return The index of the value if found in the array and -1 otherwise.
*/
export function binarySearch(
- values: number[],
- start: number,
- end: number,
- value: number,
+values: number[], start: number, end: number, value: number, value: number,
): number {
if (end < start) {
// The range is not valid so just return -1.
@@ -149,13 +146,13 @@ export function binarySearch(
const pivotIndex = Math.floor((start + end) / 2); // The index in the middle of the array.
// TODO(you): Finish implementing this algorithm
- if (pivotIndex === value) {
+ if (values[pivotIndex] === value) {
return pivotIndex;
- } else if (pivotIndex > value){
- return 0;
+ } else if (values[pivotIndex] > value) {
+ return binarySearch(values, start, pivotIndex - 1, value);
} else {
- return 1;
- }
+ return binarySearch(values, start, pivotIndex + 1, end, value);
+ }
// If values[pivotIndex] is equal to value then return `pivotIndex`.
// Else if values[pivotIndex] is greater than the value, then
// call `binarySearch(values, start, pivotIndex - 1, value)` and return its value;
From 2fcddb39f03db6e1b46640c275815aea0ebe8cd3 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:54:43 +0000
Subject: [PATCH 16/20] fix: binarySearch
if and else if statements being fixed and arranged because of 'value' in the end.
---
lesson_07/conditionals/src/lesson7.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index 51dee46c2..f59a8662c 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -136,7 +136,7 @@ export function getFirstNFibonacciNumbers(n: number): number[] {
* @return The index of the value if found in the array and -1 otherwise.
*/
export function binarySearch(
-values: number[], start: number, end: number, value: number, value: number,
+values: number[], start: number, end: number, value: number,
): number {
if (end < start) {
// The range is not valid so just return -1.
@@ -151,7 +151,7 @@ values: number[], start: number, end: number, value: number, value: number,
} else if (values[pivotIndex] > value) {
return binarySearch(values, start, pivotIndex - 1, value);
} else {
- return binarySearch(values, start, pivotIndex + 1, end, value);
+ return binarySearch(values, start, pivotIndex + 1, end);
}
// If values[pivotIndex] is equal to value then return `pivotIndex`.
// Else if values[pivotIndex] is greater than the value, then
From 1191955d57e270c2aa6f463c8678c494a50fe660 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Thu, 10 Oct 2024 12:56:42 +0000
Subject: [PATCH 17/20] fix: binarySearch
misread the comment instructions and fixed the else statement
---
lesson_07/conditionals/src/lesson7.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index f59a8662c..e4757b4ed 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -151,7 +151,7 @@ values: number[], start: number, end: number, value: number,
} else if (values[pivotIndex] > value) {
return binarySearch(values, start, pivotIndex - 1, value);
} else {
- return binarySearch(values, start, pivotIndex + 1, end);
+ return binarySearch(values, pivotIndex + 1, end, value);
}
// If values[pivotIndex] is equal to value then return `pivotIndex`.
// Else if values[pivotIndex] is greater than the value, then
From ccf406dd6c4d67a2b1e9fd1d7d43cc8f6f922278 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Fri, 11 Oct 2024 12:21:09 +0000
Subject: [PATCH 18/20] fix: removed .json file in lesson 06
---
.../codedifferently-instructional/package-lock.json | 6 ------
1 file changed, 6 deletions(-)
delete mode 100644 lesson_06/lib/typescript/codedifferently-instructional/package-lock.json
diff --git a/lesson_06/lib/typescript/codedifferently-instructional/package-lock.json b/lesson_06/lib/typescript/codedifferently-instructional/package-lock.json
deleted file mode 100644
index 5dbe3fe98..000000000
--- a/lesson_06/lib/typescript/codedifferently-instructional/package-lock.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "codedifferently-instructional",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {}
-}
From ff25c09ee7dfdb09b22e52953fce195dc57bba53 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Fri, 11 Oct 2024 12:22:44 +0000
Subject: [PATCH 19/20] fix: .json extra folder removal
---
.../codedifferently-instructional/package-lock.json | 6 ------
1 file changed, 6 deletions(-)
delete mode 100644 lesson_07/lib/typescript/codedifferently-instructional/package-lock.json
diff --git a/lesson_07/lib/typescript/codedifferently-instructional/package-lock.json b/lesson_07/lib/typescript/codedifferently-instructional/package-lock.json
deleted file mode 100644
index 5dbe3fe98..000000000
--- a/lesson_07/lib/typescript/codedifferently-instructional/package-lock.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "codedifferently-instructional",
- "lockfileVersion": 3,
- "requires": true,
- "packages": {}
-}
From 9ff9c80c1c8d9a575055cabfb42282248f1f05c4 Mon Sep 17 00:00:00 2001
From: AmiyahJo
Date: Fri, 11 Oct 2024 12:26:38 +0000
Subject: [PATCH 20/20] feat: canVote age one liner
changed my original if else statement to a simple one line code
---
lesson_07/conditionals/src/lesson7.ts | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts
index e4757b4ed..1d8eb7e55 100644
--- a/lesson_07/conditionals/src/lesson7.ts
+++ b/lesson_07/conditionals/src/lesson7.ts
@@ -7,10 +7,11 @@ import { computeLexicographicDistance } from "./util.js";
* @return True if the age corresponds to a voting age and false otherwise.
*/
export function canVote(age: number): boolean {
- if (age >= 18){
- return true;
- }
- return false;
+ return age >= 18;
+ // if (age >= 18){
+ // return true;
+ // }
+ // return false;
}
/**