From 1d6ddfda0cc099e5985990076ec9f324a5582df6 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Sat, 23 May 2026 07:53:39 +0000 Subject: [PATCH] [Sync Iteration] typescript/resistor-color-duo/3 --- .../resistor-color-duo/3/resistor-color-duo.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 solutions/typescript/resistor-color-duo/3/resistor-color-duo.ts diff --git a/solutions/typescript/resistor-color-duo/3/resistor-color-duo.ts b/solutions/typescript/resistor-color-duo/3/resistor-color-duo.ts new file mode 100644 index 0000000..4bea1ad --- /dev/null +++ b/solutions/typescript/resistor-color-duo/3/resistor-color-duo.ts @@ -0,0 +1,17 @@ +type Color = "black" | "brown" | "red" | "orange" | "yellow" | "green" | "blue" | "violet" | "grey" | "white"; +export function decodedValue([first, second]:[Color, Color]):number { + const colourCode: Record= { + "black": 0, + "brown": 1, + "red": 2, + "orange": 3, + "yellow": 4, + "green": 5, + "blue": 6, + "violet": 7, + "grey": 8, + "white": 9 + }; + return colourCode[first]*10 + colourCode[second]; + +}