LeetCode 344. Reverse String

Write a function that takes a string as input and returns the string reversed.

Example:
Given s = "hello", return "olleh".

 

分析:

var reverseString = function(s) {
    return s.split("").reverse().join("");
};

 

posted @ 2017-04-01 15:49  一片叶子啊  阅读(90)  评论(0编辑  收藏  举报