Daily Logs/Algorithm Practice

LV 0 문자열 뒤집기

Jcob.moon 2025. 6. 7. 19:15

function solution(my_string, s, e) {
    const one = my_string.slice(0, s);
    const two = my_string.slice(s, e + 1).split('').reverse().join('');
    const three = my_string.slice(e + 1);
    return one + two + three;
}
  • 주요 문법 :
    Array.prototype.slice()

Array.prototype.splice()

Array.prototype.reverse()
Array.prototype.join()