작성
·
210
·
수정됨
0
function solution (str)
{
let strArr = str.split("");
let length = strArr.length;
let answer = '';
answer = length/2 !== Math.round(length/2) ? strArr[Math.round(length/2)-1] : strArr[length/2 -1] + strArr[length/2];
return answer;
}
console.log(solution("good"));