function solution(array, commands) {
let result = [];
let temp = [];
for(let i=0; i< commands.length ; i++){
temp = array.slice(commands[i][0]-1, commands[i][1]).sort((a,b)=>a-b);
result.push(temp[commands[i][2]-1]);
console.log(temp);
}
return result;
}
내가 실수했던게 문자열 자를 때 쓰는게 split이고 배열자를때는 slice를 써야되는데 헷갈린것!
그리고 sort안에 함수 안넣으면 유니코드 순대로 정렬된다고 해서 sort()로 했는데 그러니까 100퍼센트 통과로 안나왔다. 그래서 sort안에 함수를 넣어주니까 해결!