diff --git a/numericalAlphabet/makeNumericalAlphabet-jamie-neel.js b/numericalAlphabet/makeNumericalAlphabet-jamie-neel.js new file mode 100644 index 0000000..8a0f804 --- /dev/null +++ b/numericalAlphabet/makeNumericalAlphabet-jamie-neel.js @@ -0,0 +1,14 @@ +const makeNumericalAlphabet = str => { + const arr = str.split("") + const resArr =[] + arr.forEach(character => { + const lowerChar = character.toLowerCase(); + const regexAZ = /[a-z]/gmi; + if(regexAZ.test(lowerChar)){ + const charCodeIndex = lowerChar.charCodeAt(0); + resArr.push(charCodeIndex - 96) + } + }); + return resArr.join(" "); +} +module.exports = {makeNumericalAlphabet} diff --git a/numericalAlphabet/solution.test.js b/numericalAlphabet/solution.test.js index 4d43602..4ac1635 100644 --- a/numericalAlphabet/solution.test.js +++ b/numericalAlphabet/solution.test.js @@ -1,4 +1,4 @@ -const { makeNumericalAlphabet } = require('./PersonsSolution'); +const {makeNumericalAlphabet} = require('./makeNumericalAlphabet-jamie-neel'); describe('makeNumericalAlphabet', () => { it('should find the outlier when it is an even number', () => {