Skip to content

Commit 9a45b61

Browse files
authored
Create 344-ReverseString.js
1 parent d5c0e12 commit 9a45b61

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

344-ReverseString.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**Write a function that takes a string as input and returns the string reversed.
2+
3+
Example:
4+
Given s = "hello", return "olleh".
5+
*/
6+
7+
/**
8+
* @param {string} s
9+
* @return {string}
10+
*/
11+
var reverseString = function(s) {
12+
return s.split('').reverse().join('');
13+
};
14+
15+
16+

0 commit comments

Comments
 (0)