var splitString = str.split(“”);// Use the reverse() method to reverse the array
var arrayReverse = splitString.reverse(); // equals to [“e”, “m”, “o”, “c”, “l”, “e”, “w”]
// Use join() method to join the elements of the array into a string as below in comments
var joinArray = arrayReverse .join(“”); // [“e”, “m”, “o”, “c”, “l”, “e”, “w”] to “emoclew”
//Return the reversed string
return joinArray; // “emoclew”
}
stringRev(‘welcome’);