function reverStr(param) { //jparam形参 var arr = param.split(""); //分割数组 var newArr = []; for (i = 0; i < arr.length; i++) { //利用for循环实现数据位置调换 newArr[arr.length - i] = arr[i]; } return newStr = newArr.join('') //返回并赋值给newStr } var oldstr =reverStr('1234567') console.log(newStr)