From 8b1c9ed744acc8e48a237bc210c8b08cee7d79a7 Mon Sep 17 00:00:00 2001 From: Gogi Date: Sun, 18 Apr 2021 20:51:13 +0300 Subject: [PATCH] completed js-intro-exercism quiz --- "JS Intro \342\200\223 Exercism/hello-world-solution.js" | 3 +++ .../resistor-color-solution.js" | 9 +++++++++ "JS Intro \342\200\223 Exercism/two-fer-solution.js" | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 "JS Intro \342\200\223 Exercism/hello-world-solution.js" create mode 100644 "JS Intro \342\200\223 Exercism/resistor-color-solution.js" create mode 100644 "JS Intro \342\200\223 Exercism/two-fer-solution.js" diff --git "a/JS Intro \342\200\223 Exercism/hello-world-solution.js" "b/JS Intro \342\200\223 Exercism/hello-world-solution.js" new file mode 100644 index 0000000..3aa9417 --- /dev/null +++ "b/JS Intro \342\200\223 Exercism/hello-world-solution.js" @@ -0,0 +1,3 @@ +export const hello = () => { + return "Hello, World!"; +}; diff --git "a/JS Intro \342\200\223 Exercism/resistor-color-solution.js" "b/JS Intro \342\200\223 Exercism/resistor-color-solution.js" new file mode 100644 index 0000000..e3320d9 --- /dev/null +++ "b/JS Intro \342\200\223 Exercism/resistor-color-solution.js" @@ -0,0 +1,9 @@ +export const colorCode = (color) => { + for (let i = 0; i < COLORS.length; i++) { + if (COLORS[i] === color) { + return i; + } + } +}; + +export const COLORS = ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"]; diff --git "a/JS Intro \342\200\223 Exercism/two-fer-solution.js" "b/JS Intro \342\200\223 Exercism/two-fer-solution.js" new file mode 100644 index 0000000..d280f38 --- /dev/null +++ "b/JS Intro \342\200\223 Exercism/two-fer-solution.js" @@ -0,0 +1,3 @@ +export const twoFer = (name = "you") => { + return `One for ${name}, one for me.`; +};