Created
February 12, 2020 20:05
-
-
Save willwalker753/a4ff3700f151f42233a6b9340a90e341 to your computer and use it in GitHub Desktop.
Text normalizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function textNormalizer(text) { | |
let normal = text.toLowerCase(); | |
normal = normal.trim(); | |
return normal; | |
} | |
let text = " let's GO SURFING NOW everyone is learning how "; | |
console.log(textNormalizer(text)); | |
function testTextNormalizer() { | |
const text = " let's GO SURFING NOW everyone is learning how "; | |
const expected = "let's go surfing now everyone is learning how"; | |
if (textNormalizer(text) === expected) { | |
console.log('SUCCESS: `textNormalizer` is working'); | |
} else { | |
console.log('FAILURE: `textNormalizer` is not working'); | |
} | |
} | |
testTextNormalizer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment