更新时间:2022-11-11 10:51:25
尝试以下操作:
Try this:
var str = 'hi how are you';
var reversedStr = str.split("").reverse().join("");
我在Chrome JavaScript控制台中对此进行了测试.效果很好.
注意:如果是请告诉我紧急"这类问题,则可以用Google搜索"javascript反向字符串"并在10秒内找到答案.
I tested this in my Chrome JavaScript console. works fine.
Note: If it was ''please tell me urgent'' kind of question, you could have Googled ''javascript reverse string'' and found the answer within 10 seconds.