diff options
| -rw-r--r-- | challenge-279/kai-burgdorf/JavaScript/ch-1.js | 16 | ||||
| -rw-r--r-- | challenge-279/kai-burgdorf/JavaScript/ch-2.js | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-279/kai-burgdorf/JavaScript/ch-1.js b/challenge-279/kai-burgdorf/JavaScript/ch-1.js new file mode 100644 index 0000000000..30cfb2dc2b --- /dev/null +++ b/challenge-279/kai-burgdorf/JavaScript/ch-1.js @@ -0,0 +1,16 @@ +//const letters = ['R', 'E', 'P', 'L']; +//const weights = [3, 2, 1, 4]; + +//const letters = ['A', 'U', 'R', 'K']; +//const weights = [2, 4, 1, 3]; + +const letters = ['O', 'H', 'Y', 'N', 'P', 'T']; +const weights = [5, 4, 2, 6, 1, 3]; + +let outArr = []; + +letters.map((letter, index) => { + outArr[(parseInt(weights[index]))] = letter; +}) + +console.log( "Output: " + outArr.join('') ); diff --git a/challenge-279/kai-burgdorf/JavaScript/ch-2.js b/challenge-279/kai-burgdorf/JavaScript/ch-2.js new file mode 100644 index 0000000000..20e1f8fcd2 --- /dev/null +++ b/challenge-279/kai-burgdorf/JavaScript/ch-2.js @@ -0,0 +1,12 @@ +//const str = "perl"; +//const str = "book"; +const str = "good morning"; + +const vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']; +let vowelsCount = 0; + +str.split('').map(o => { + if(vowels.includes(o)) vowelsCount++; +}); + +console.log("Output: " + ((vowelsCount % 2) ? "false" : "true" )); |
