Untitled
unknown
javascript
3 years ago
449 B
6
Indexable
const array = [ "Ana Paula", "Alvaro", "Jesus", "Steve", "Antonio", "Mega Ultra Jesus", ]; function longestStudent(array) { let longestName = ""; for (let index = 0; index < array.length; index++) { console.log(array[index]); if (array[index].length > longestName.length) { longestName = array[index]; } } console.log("Nombre más largo: ", longestName); } longestStudent(array);
Editor is loading...