From cdbec5140a49ce983105d4231549d2aba2670d1e Mon Sep 17 00:00:00 2001 From: Zadri Date: Fri, 13 Mar 2026 15:17:43 +0000 Subject: [PATCH 1/8] implement solutions and rewrite tests with jest --- .../implement/1-get-angle-type.js | 45 +++++++++++++++++ .../implement/2-is-proper-fraction.js | 15 ++++++ .../implement/3-get-card-value.js | 48 ++++++++++++++++++- .../1-get-angle-type.test.js | 38 ++++++++++++++- .../2-is-proper-fraction.test.js | 42 ++++++++++++++++ .../3-get-card-value.test.js | 23 +++++++++ 6 files changed, 208 insertions(+), 3 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 9e05a871e..89f70fee9 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -8,6 +8,8 @@ // - "Reflex angle" for angles greater than 180° and less than 360° // - "Invalid angle" for angles outside the valid range. +const { assertEquals, isProperFraction } = require("./2-is-proper-fraction"); + // Assumption: The parameter is a valid number. (You do not need to handle non-numeric inputs.) // Acceptance criteria: @@ -16,6 +18,18 @@ function getAngleType(angle) { // TODO: Implement this function + if (angle > 0 && angle < 90) + return "Acute angle"; + else if (angle === 90) + return "Right angle"; + else if (angle > 90 && angle < 180) + return "obtuse angle"; + else if (angle === 180) + return "Straight angle" + else if (angle > 180 && angle < 360) + return "Reflex angle"; + else + return "Invalid angle"; } // The line below allows us to load the getAngleType function into tests in other files. @@ -35,3 +49,34 @@ function assertEquals(actualOutput, targetOutput) { // Example: Identify Right Angles const right = getAngleType(90); assertEquals(right, "Right angle"); + +const acute = getAngleType(45); +assertEquals(acute, "Acute angle"); + +const obtuse = getAngleType(120); +assertEquals(obtuse, "obtuse angle"); + +const straight = getAngleType(180); +assertEquals(straight, "Straight angle"); + +const relex = getAngleType(270); +assertEquals(relex, "Reflex angle"); + +const invalid = getAngleType(400); +assertEquals(invalid, "Invalid angle"); +assertEquals(isProperFraction(2, 2), false); +assertEquals(isProperFraction(0, 0), false); +// Case 3: Obtuse angles +test(`should return "obtuse angle" when (90 < angle < 180)`, () => { + expect(getAngleType(120)).toEqual("obtuse angle"); + expect(getAngleType(179)).toEqual("obtuse angle"); + expect(getAngleType(179.99)).toEqual("obtuse angle"); + expect(getAngleType(179.999)).toEqual("obtuse angle"); + expect(getAngleType(179.9999)).toEqual("obtuse angle"); + expect(getAngleType(179.99999)).toEqual("obtuse angle"); + expect(getAngleType(179.999999)).toEqual("obtuse angle"); + expect(getAngleType(179.9999999)).toEqual("obtuse angle"); + expect(getAngleType(179.99999999)).toEqual("obtuse angle"); + expect(getAngleType(179.999999999)).toEqual("obtuse angle"); + +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 970cb9b64..3c6c866d5 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,7 +12,14 @@ function isProperFraction(numerator, denominator) { // TODO: Implement this function + if (denominator === 0){ + return false; + } + + return numerator < denominator; + } +exports.isProperFraction = isProperFraction; // The line below allows us to load the isProperFraction function into tests in other files. // This will be useful in the "rewrite tests with jest" step. @@ -25,9 +32,17 @@ function assertEquals(actualOutput, targetOutput) { `Expected ${actualOutput} to equal ${targetOutput}` ); } +exports.assertEquals = assertEquals; // TODO: Write tests to cover all cases. // What combinations of numerators and denominators should you test? // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); +assertEquals(isProperFraction(2, 1), false); +assertEquals(isProperFraction(0, 1), true); +assertEquals(isProperFraction(1, 0), false); +assertEquals(isProperFraction(-1, 2), true); +assertEquals(isProperFraction(1, -2), false); +assertEquals(isProperFraction(-1, -2), false); + diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index c7559e787..1104c06af 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -23,7 +23,34 @@ function getCardValue(card) { // TODO: Implement this function + const rank = card.slice(0, -1); // get the rank by slicing off the last character (the suit) + const suit = card.slice(-1); // get the suit by taking the last character + + const validSuits = ["♠", "♥", "♦", "♣"]; // Define valid suits + if (!validSuits.includes(suit)) { // check if the suit is valid + throw new Error("Invalid card"); // If the suit is not valid, throw an error + } + + const faceCardValues = { // Define the values for face cards and ace + "A": 11, // Ace is worth 11 + "J": 10, // Jack is worth 10 + "Q": 10, // Queen is worth 10 + "K": 10 // King is worth 10 + }; + if (faceCardValues[rank]) { // Check if the rank is a face card or ace + return faceCardValues[rank]; // If it is, return the corresponding value + } + + const numericValue = parseInt(rank); // Try to parse the rank as a number + if (numericValue >= 2 && numericValue <= 10) { // check if the numeric value is between 2 and 10 + return numericValue; // If it is, return the numeric value + } + + throw new Error("Invalid card"); // If the rank is not valid (not a face card, ace, or number between 2 and 10), throw an error } +console.log(getCardValue("A♠")); // 11 +console.log(getCardValue("2♥")); // 2 +console.log(getCardValue("J♣")); // 10 // The line below allows us to load the getCardValue function into tests in other files. // This will be useful in the "rewrite tests with jest" step. @@ -40,13 +67,30 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. // Examples: assertEquals(getCardValue("9♠"), 9); +assertEquals(getCardValue("A♥"), 11); +assertEquals(getCardValue("J♣"), 10); +assertEquals(getCardValue("Q♦"), 10); +assertEquals(getCardValue("K♠"), 10); +assertEquals(getCardValue("10♥"), 10); +assertEquals(getCardValue("2♦"), 2); + // Handling invalid cards -try { - getCardValue("invalid"); +try { + getCardValue("1 ♠"); // Invalid rank // This line will not be reached if an error is thrown as expected console.error("Error was not thrown for invalid card"); } catch (e) {} + // What other invalid card cases can you think of? +try { + getCardValue("11♠"); // Invalid rank + console.error("Error was not thrown for invalid card"); +} catch (e) {} + +try { + getCardValue("h♠"); // Valid card + console.error("Error was thrown for valid card"); +} catch (e) {} diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index d777f348d..6d9b39edc 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -14,7 +14,43 @@ test(`should return "Acute angle" when (0 < angle < 90)`, () => { }); // Case 2: Right angle -// Case 3: Obtuse angles +test('should return "Right angle" when angle is exactly 90', () => { + expect(getAngleType(90)).toEqual("Right angle"); +}); // Case 4: Straight angle +test(`should return "Straight angle" when angle is exactly 180`, () => { + expect(getAngleType(180)).toEqual("Straight angle"); +}); + // Case 5: Reflex angles +test(`should return "Reflex angle" when (180 < angle < 360)`, () => { + expect(getAngleType(181)).toEqual("Reflex angle"); + expect(getAngleType(190)).toEqual("Reflex angle"); + expect(getAngleType(200)).toEqual("Reflex angle"); + expect(getAngleType(300)).toEqual("Reflex angle"); + expect(getAngleType(359)).toEqual("Reflex angle"); + expect(getAngleType(359.90)).toEqual("Reflex angle"); + expect(getAngleType(359.99)).toEqual("Reflex angle"); + expect(getAngleType(359.999)).toEqual("Reflex angle"); + expect(getAngleType(359.9999)).toEqual("Reflex angle"); + expect(getAngleType(359.99999)).toEqual("Reflex angle"); + expect(getAngleType(359.999999)).toEqual("Reflex angle"); + expect(getAngleType(359.9999999)).toEqual("Reflex angle"); + expect(getAngleType(359.99999999)).toEqual("Reflex angle"); + expect(getAngleType(359.999999999)).toEqual("Reflex angle"); + + +}); // Case 6: Invalid angles +test(`should return "Invalid angle" when angle (angle <= 0 or angle >= 360)`, () => { + expect(getAngleType(-1)).toEqual("Invalid angle"); + expect(getAngleType(0)).toEqual("Invalid angle"); + expect(getAngleType(-0.1)).toEqual("Invalid angle"); + expect(getAngleType(-10)).toEqual("Invalid angle"); + expect(getAngleType(360)).toEqual("Invalid angle"); + expect(getAngleType("string")).toEqual("Invalid angle"); + expect(getAngleType(null)).toEqual("Invalid angle"); + expect(getAngleType(undefined)).toEqual("Invalid angle"); + expect(getAngleType(NaN)).toEqual("Invalid angle"); + +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 7f087b2ba..b92e72dad 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -8,3 +8,45 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); }); + +test(`should return true in normal cases where numerator < denominator`, () => { + expect(isProperFraction(1, 2)).toEqual(true); +}); + +test(`should return false when numerator >= denominator`, () => { + expect(isProperFraction(2, 1)).toEqual(false); + expect(isProperFraction(2, 2)).toEqual(false); +}); + +test('should return true when numerator is negative and denominator is positive', () => { + expect(isProperFraction(-1, 2)).toEqual(true); + expect(isProperFraction(-2, 1)).toEqual(true); + expect(isProperFraction(-2, 2)).toEqual(true) + +}); + +test(`should return false when numerator is positive and denominator is negative`, () => { + expect(isProperFraction(1, -2)).toEqual(false); + expect(isProperFraction(2, -1)).toEqual(false); + +}); + +test(`should return false when numerator and denominator are both negative`, () => { + expect(isProperFraction(-1, -2)).toEqual(false); + expect(isProperFraction(-2, -1)).toEqual(false); + expect(isProperFraction(-2, -2)).toEqual(false); +}); + +test(`should return true when numerator is zero and denominator is positive`, () => { + expect(isProperFraction(0, 1)).toEqual(true); + expect(isProperFraction(0, 2)).toEqual(true); + +}); + +test(`should return false when numerator is zero and denominator is negative`, () => { + expect(isProperFraction(0, -1)).toEqual(false); + expect(isProperFraction(0, -2)).toEqual(false); + +}); + + diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index cf7f9dae2..f93f82d4d 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -9,10 +9,33 @@ test(`Should return 11 when given an ace card`, () => { expect(getCardValue("A♠")).toEqual(11); }); + // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) +test(`Should return the correct value for number cards (2-10)`, () => { + expect(getCardValue("2♠")).toEqual(2); + expect(getCardValue("3♥")).toEqual(3); + expect(getCardValue("4♦")).toEqual(4); + expect(getCardValue("5♣")).toEqual(5); + expect(getCardValue("6♠")).toEqual(6); + expect(getCardValue("7♥")).toEqual(7); + expect(getCardValue("8♦")).toEqual(8); + expect(getCardValue("9♣")).toEqual(9); + expect(getCardValue("10♠")).toEqual(10); +}) // Face Cards (J, Q, K) +test(`Should return 10 for face cards (J, Q, K)`, () => { + expect(getCardValue("J♥")).toEqual(10); + expect(getCardValue("Q♦")).toEqual(10); + expect(getCardValue("K♣")).toEqual(10); +}); + // Invalid Cards +test(`Should throw an error for invalid cards`, () => { + expect(() => getCardValue("1♠")).toThrow("Invalid card"); + expect(() => getCardValue("11♣")).toThrow("Invalid card"); + expect(() => getCardValue("A♦")).toThrow("Invalid card"); +}); // To learn how to test whether a function throws an error as expected in Jest, // please refer to the Jest documentation: From e91084301ed014f4496443c370df5f4d1bad403c Mon Sep 17 00:00:00 2001 From: Zadri Date: Fri, 13 Mar 2026 17:27:48 +0000 Subject: [PATCH 2/8] implement function for getAngleType --- .../implement/1-get-angle-type.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 89f70fee9..cc40fb853 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -16,9 +16,9 @@ const { assertEquals, isProperFraction } = require("./2-is-proper-fraction"); // After you have implemented the function, write tests to cover all the cases, and // execute the code to ensure all tests pass. -function getAngleType(angle) { +function getAngleType(angle) { // This function should return a string indicating the type of angle based on the input angle in degrees. // TODO: Implement this function - if (angle > 0 && angle < 90) + if (angle > 0 && angle < 90) return "Acute angle"; else if (angle === 90) return "Right angle"; From ff052134585092534691d9e7a1848a0dddfd44f9 Mon Sep 17 00:00:00 2001 From: Zadri Date: Fri, 13 Mar 2026 17:37:57 +0000 Subject: [PATCH 3/8] implement function for isProperFraction --- .../implement/2-is-proper-fraction.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 3c6c866d5..9da00e3d6 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -38,8 +38,8 @@ exports.assertEquals = assertEquals; // What combinations of numerators and denominators should you test? // Example: 1/2 is a proper fraction -assertEquals(isProperFraction(1, 2), true); -assertEquals(isProperFraction(2, 1), false); +assertEquals(isProperFraction(1, 2), true); // 2 is greater than 1, so this should return true. +assertEquals(isProperFraction(2, 1), false); // 1 is not greater than 2, so this should return false. assertEquals(isProperFraction(0, 1), true); assertEquals(isProperFraction(1, 0), false); assertEquals(isProperFraction(-1, 2), true); From 2a83c2f57665e35776df4bc5ab65d31466b6e3f8 Mon Sep 17 00:00:00 2001 From: Zadri Date: Fri, 13 Mar 2026 17:41:48 +0000 Subject: [PATCH 4/8] implement function for getCardValue --- .../implement/3-get-card-value.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index 1104c06af..ba369cec9 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -66,13 +66,13 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. // Examples: -assertEquals(getCardValue("9♠"), 9); -assertEquals(getCardValue("A♥"), 11); -assertEquals(getCardValue("J♣"), 10); -assertEquals(getCardValue("Q♦"), 10); -assertEquals(getCardValue("K♠"), 10); -assertEquals(getCardValue("10♥"), 10); -assertEquals(getCardValue("2♦"), 2); +assertEquals(getCardValue("9♠"), 9); // should return 9 for the 9 of spades +assertEquals(getCardValue("A♥"), 11); // should return 11 for the ace of hearts +assertEquals(getCardValue("J♣"), 10); // should return 10 for the jack of clubs +assertEquals(getCardValue("Q♦"), 10); // should return 10 for the queen of diamonds +assertEquals(getCardValue("K♠"), 10); // should return 10 for the king of spades +assertEquals(getCardValue("10♥"), 10); // should return 10 for the 10 of hearts +assertEquals(getCardValue("2♦"), 2); // should return 2 for the 2 of diamonds // Handling invalid cards From 72c85b3dc0ef2f704ba4b40f3543053ca19ca85f Mon Sep 17 00:00:00 2001 From: Zadri Date: Fri, 13 Mar 2026 17:46:40 +0000 Subject: [PATCH 5/8] rewrite tests with Jest --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index 6d9b39edc..6a8729af4 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -8,9 +8,9 @@ const getAngleType = require("../implement/1-get-angle-type"); // Case 1: Acute angles test(`should return "Acute angle" when (0 < angle < 90)`, () => { // Test various acute angles, including boundary cases - expect(getAngleType(1)).toEqual("Acute angle"); - expect(getAngleType(45)).toEqual("Acute angle"); - expect(getAngleType(89)).toEqual("Acute angle"); + expect(getAngleType(1)).toEqual("Acute angle"); // should return "Acute angle" for angles just above 0 + expect(getAngleType(45)).toEqual("Acute angle"); // should return "Acute angle" for a typical acute angle + expect(getAngleType(89)).toEqual("Acute angle"); // should return "Acute angle" for angles just below 90 }); // Case 2: Right angle From e9e9ff978c1a010dd51fdbe17b7f86bb1cde6d2b Mon Sep 17 00:00:00 2001 From: Zadri Abdule Date: Sun, 15 Mar 2026 18:56:30 +0000 Subject: [PATCH 6/8] Update 2-is-proper-fraction.js --- .../implement/2-is-proper-fraction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 9da00e3d6..7a6425bc1 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -16,7 +16,7 @@ function isProperFraction(numerator, denominator) { return false; } - return numerator < denominator; + return Math.abs(numerator) < Math.abs(denominator); } exports.isProperFraction = isProperFraction; From 3f1984c509cfcf2d0361cb86b315232939672356 Mon Sep 17 00:00:00 2001 From: Zadri Abdule Date: Sun, 15 Mar 2026 21:35:05 +0000 Subject: [PATCH 7/8] Update 1-get-angle-type.test.js --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index 6a8729af4..0ba23c974 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -38,8 +38,6 @@ test(`should return "Reflex angle" when (180 < angle < 360)`, () => { expect(getAngleType(359.9999999)).toEqual("Reflex angle"); expect(getAngleType(359.99999999)).toEqual("Reflex angle"); expect(getAngleType(359.999999999)).toEqual("Reflex angle"); - - }); // Case 6: Invalid angles test(`should return "Invalid angle" when angle (angle <= 0 or angle >= 360)`, () => { @@ -48,9 +46,4 @@ test(`should return "Invalid angle" when angle (angle <= 0 or angle >= 360)`, () expect(getAngleType(-0.1)).toEqual("Invalid angle"); expect(getAngleType(-10)).toEqual("Invalid angle"); expect(getAngleType(360)).toEqual("Invalid angle"); - expect(getAngleType("string")).toEqual("Invalid angle"); - expect(getAngleType(null)).toEqual("Invalid angle"); - expect(getAngleType(undefined)).toEqual("Invalid angle"); - expect(getAngleType(NaN)).toEqual("Invalid angle"); - }); From 4ea82f44d6659a4ff998cbbe7014430e1e46e7f5 Mon Sep 17 00:00:00 2001 From: Zadri Abdule Date: Sun, 15 Mar 2026 21:49:49 +0000 Subject: [PATCH 8/8] Update 3-get-card-value.js --- .../1-implement-and-rewrite-tests/implement/3-get-card-value.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index ba369cec9..a5d4dfd2f 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -48,7 +48,7 @@ function getCardValue(card) { throw new Error("Invalid card"); // If the rank is not valid (not a face card, ace, or number between 2 and 10), throw an error } -console.log(getCardValue("A♠")); // 11 + console.log(getCardValue("2♥")); // 2 console.log(getCardValue("J♣")); // 10