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"