가장 긴 문자열을 출력
function solution(str){
let result, num = Number.MIN_SAFE_INTEGER;
for(let x of str) {
if(num<x.length) {
num = x.length;
result = x;
}
}
return result;
}
let str = ['teacher', 'time', 'student', 'beautiful', 'good'] ;
console.log(solution(str));