Skip to content

Instantly share code, notes, and snippets.

@omokehinde
Created May 30, 2022 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omokehinde/e0cae7a74d384eac5e9f0206aa25ab6e to your computer and use it in GitHub Desktop.
Save omokehinde/e0cae7a74d384eac5e9f0206aa25ab6e to your computer and use it in GitHub Desktop.
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