Skip to content

Instantly share code, notes, and snippets.

@moonformeli
Created November 9, 2019 06:47
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 moonformeli/95205178280289c189e5dc00ee2b0ba0 to your computer and use it in GitHub Desktop.
Save moonformeli/95205178280289c189e5dc00ee2b0ba0 to your computer and use it in GitHub Desktop.
function getLongestName(names) {
let longestName = ''
for (let i = 0; i < names.length; i += 1) {
const nameLen = names[i].length;
if (longestName.length < nameLen) {
longestName = names[i]
}
}
return longestName;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment