📜  Javascript代码示例中的反转字符串

📅  最后修改于: 2022-03-11 15:01:25.007000             🧑  作者: Mango

代码示例6
function reverseString(str) {
    var newString = "";
    for (var i = str.length - 1; i >= 0; i--) {
        newString += str[i];
    }
    return newString;
}
console.log(reverseString('welcome'));