Last active
March 1, 2024 17:31
-
-
Save cplpearce/e7ccddb7d485d076ac777c253022649e to your computer and use it in GitHub Desktop.
Kata 4 - Instructors Names
This file contains hidden or 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 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