标签:
var fruit = "apple banana pear"; var arr = fruit.split(‘ ‘); for (var i = 0; i < arr.length; i++) { arr[i] = arr[i].split(‘‘).reverse().join(‘‘); } var newfruit = arr.join(‘ ‘); // 1 var newfruit2 = fruit.replace(/\s/g, ‘.‘).split(‘‘).reverse().join(‘‘).replace(/\./g, ‘ ‘); // 2
// python: ‘ ‘.join(fruit[::-1].split(‘ ‘)[::-1])
标签:
原文地址:http://www.cnblogs.com/xiaoroad/p/4600142.html