字符串反转
先将字符串转成数组,然后再将数组反转,最后将数组转成字符串输出
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>字符串反转</title>
<script type="text/javascript">
var sTr = "123asdf79888asdfe21";
//1、split字符串转成数组
//2、reverse数组反转
//3、join数组转成字符串
var sTr2 = sTr.split('').reverse().join('');
alert(sTr2);//12efdsa88897fdsa321
</script>
</head>
<body>
</body>
</html>