Skip to content

Instantly share code, notes, and snippets.

@cplpearce
Last active March 1, 2024 17:31
Show Gist options
  • Save cplpearce/e7ccddb7d485d076ac777c253022649e to your computer and use it in GitHub Desktop.
Save cplpearce/e7ccddb7d485d076ac777c253022649e to your computer and use it in GitHub Desktop.
Kata 4 - Instructors Names
const instructorWithLongestName = function(instructors) {
let longestName = "";
for (let i of instructors) {
i.name.length > longestName.length && (longestName = i.name);
}
return longestName;
};
console.log(instructorWithLongestName([
{name: "Samuel", course: "iOS"},
{name: "Jeremiah", course: "Web"},
{name: "Ophilia", course: "Web"},
{name: "Donald", course: "Web"}
]));
console.log(instructorWithLongestName([
{name: "Matthew", course: "Web"},
{name: "David", course: "iOS"},
{name: "Domascus", course: "Web"}
]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment