Skip to content

Instantly share code, notes, and snippets.

@omesser
Created November 18, 2022 15:16
Show Gist options
  • Select an option

  • Save omesser/508871b98398759488337fa39f81c778 to your computer and use it in GitHub Desktop.

Select an option

Save omesser/508871b98398759488337fa39f81c778 to your computer and use it in GitHub Desktop.
prettify.js
/*
Make the function more readable and maintainable
Please do not comment on this public gist (comments will be removed)
Please do not fork on this public gist - if you got here from
an application form, please reply privately on the form.
This is used as part of a hiring pipeline, I ask you to respect that.
*/
function doStuff(text) {
const lowerCased = text.toLocaleLowerCase();
const words = lowerCased.split(' ');
words.reverse();
const trimmedWords = [];
for (let i in words) {
trimmedWords.push(words[i].trim());
}
const longWords = [];
for (let i in trimmedWords) {
if (trimmedWords[i].length > 5) {
longWords.push(trimmedWords[i]);
}
}
let result = '';
for (let i in longWords) {
result += longWords[i];
result += ', ';
}
return result.slice(0, -2);
}
@omesser

omesser commented Jan 29, 2023

Copy link
Copy Markdown
Author

Please do not comment on this public gist (comments will be removed)
Please do not fork on this public gist - if you got here from
an application form, please reply privately on the form.
This is used as part of a hiring pipeline, I ask you to respect that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment