字符串翻转

4年以前  |  阅读数:500 次  |  编程语言:JavaScript 
function reverseStr(str = "") {
    return str.split("").reduceRight((t, v) = > t + v);
}

const str = "reduce123";
console.log(reverseStr(str)); // "123recuder"

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8