We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d723fc commit 878593aCopy full SHA for 878593a
ReverseAString.js
@@ -0,0 +1,22 @@
1
+/**
2
+ * Given a string, reverse it!
3
+ */
4
+
5
+// This can be solved by splitting the string into an array. split("")
6
+// Reversing the array, then joining it back together. reverse().join("")
7
8
+const reverseString = inputString => {
9
+ return inputString.split("").reverse().join("")
10
+}
11
12
+console.log(reverseString("Stefan"))
13
+console.log(reverseString("Lamario"))
14
+console.log(reverseString("Bayne"))
15
16
17
+ * Output:
18
+ *
19
+ * nafetS
20
+ * oiramaL
21
+ * enyaB
22
0 commit comments