// reverse var name = "My city is WH"; var resultStr = name.split('').reverse().join(''); console.log(resultStr); // HW si ytic yM // charAt var name = "My city is WuHan"; var nameArr = name.split(''); var resultStr = ''; for (var i = nameArr.length-1; i >= 0; i--) { resultStr += name.charAt(i); } console.log(resultStr); // naHuW si ytic yM