翻转字符串
<script>
// reversevar
name = "My city is WH";
var resultStr = name.split('').reverse().join('');
console.log(resultStr); // HW si ytic yM // charAtvar
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
</script>