문자열 배열
strlist
가 매개변수로 주어집니다.strlist
각 원소의 길이를 담은 배열을 retrun하도록 solution 함수를 완성해 주세요.
strlist
원소의 길이 ≤ 100strlist
는 알파벳 소문자, 대문자, 특수문자로 구성되어 있습니다.strlist | result |
---|---|
["We", "are", "the", "world!"] | [2, 3, 3, 6] |
["I", "Love", "Programmers."] | [1, 4, 12] |
function solution(strlist) {
let answer = []
for (let x of strlist) {
answer.push(x.length)
}
return answer
}