Created
May 30, 2022 22:53
-
-
Save omokehinde/e0cae7a74d384eac5e9f0206aa25ab6e to your computer and use it in GitHub Desktop.
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
const pointlessFunction = (input: string): string => { | |
let oneToThreeObj = { | |
1: "one", 2: "two", 3: "three" | |
}; | |
let output = ""; | |
[...input].forEach((char)=>{ | |
// ts-ignore | |
if (char in oneToThreeObj) output+=oneToThreeObj[char]; | |
}); | |
return output; | |
} | |
console.log(pointlessFunction("t1k3h2k4")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment