diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2023-03-13 07:42:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-13 07:42:18 +0000 |
| commit | a8b1837fcd58b7589791e42b2ef4788e0e8ed7d7 (patch) | |
| tree | 9cb49257e2fb7efc242e7809841e1e49f561d2ff | |
| parent | 8183781a5ec8794681b90422b447957e9d77c8c3 (diff) | |
| parent | 1df85bcd9cbc24c3685d70f176d143a588a581ea (diff) | |
| download | perlweeklychallenge-club-a8b1837fcd58b7589791e42b2ef4788e0e8ed7d7.tar.gz perlweeklychallenge-club-a8b1837fcd58b7589791e42b2ef4788e0e8ed7d7.tar.bz2 perlweeklychallenge-club-a8b1837fcd58b7589791e42b2ef4788e0e8ed7d7.zip | |
Merge pull request #7711 from ealvar3z/challenge-207_eax
week 207 solution in JavaScript
| -rw-r--r-- | challenge-207/ealvar3z/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-207/ealvar3z/js/ch-1.js | 31 | ||||
| -rw-r--r-- | challenge-207/ealvar3z/rust/.gitignore | 3 |
3 files changed, 32 insertions, 3 deletions
diff --git a/challenge-207/ealvar3z/blog.txt b/challenge-207/ealvar3z/blog.txt new file mode 100644 index 0000000000..4e03b8b035 --- /dev/null +++ b/challenge-207/ealvar3z/blog.txt @@ -0,0 +1 @@ +https://eax.bearblog.dev/king-of-strings/ diff --git a/challenge-207/ealvar3z/js/ch-1.js b/challenge-207/ealvar3z/js/ch-1.js new file mode 100644 index 0000000000..936504111f --- /dev/null +++ b/challenge-207/ealvar3z/js/ch-1.js @@ -0,0 +1,31 @@ +#!/usr/bin/node + +const assert = require("assert"); + +// Tests + +const test_one = ["Hello", "Alaska", "Dad", "Peace"]; +const test_two = ["OMG", "Bye"]; + +const _1 = test_one.filter(task_one); +const _2 = test_two.filter(task_one); + +console.log(_1); +console.log(_2); + +assert.deepStrictEqual(_1, ["Alaska", "Dad"]); +assert.deepStrictEqual(_2, []); + +// Implementation + +const q = /[qwertyuiop]+/i; +const a = /[asdfghjkl]+/i; +const z = /[zxcvbnm]+/i; + +function task_one(w) { + const compile = `^(${q.source}|${a.source}|${z.source})$`; + const re = new RegExp(compile, "i"); + return re.test(w); +} + + diff --git a/challenge-207/ealvar3z/rust/.gitignore b/challenge-207/ealvar3z/rust/.gitignore deleted file mode 100644 index 9a30948bdd..0000000000 --- a/challenge-207/ealvar3z/rust/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target -Cargo.toml -Cargo.lock |
