📜  js中的反向字符串 - Javascript代码示例

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

代码示例6
let a = "foo";

// function for reversing a string
function reverseString(str) {
  return str.split("").reverse().join("");
}

console.log(a); // "foo"

let b = reverseString(a);
console.log(b); // "oof"