Skip to content

Commit 054d1f7

Browse files
committed
FirstReverse
1 parent da807d6 commit 054d1f7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

FirstReverse.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Have the function FirstReverse(str) take the str parameter being passed and
2+
// return the string in reversed order.
3+
// For example: if the input string is "Hello World and Coders" then your program should return the string sredoC dna dlroW olleH.
4+
// Examples
5+
// Input: "coderbyte"
6+
// Output: etybredoc
7+
// Input: "I Love Code"
8+
// Output: edoC evoL I
9+
function FirstReverse(str) {
10+
var temp = '';
11+
for (var i = 0; i<str.length; i++) {
12+
temp = str[i] + temp;
13+
}
14+
// code goes here
15+
return temp;
16+
17+
}
18+
19+
// keep this function call here
20+
FirstReverse(readline());

0 commit comments

Comments
 (0)