Post History
Your goal is to reverse an ascii string. Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward. Function...
Question
code-golf
#4: Post edited
- Your goal is to reverse an ascii string.
- Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward.
- Function answers will not be given a newline, and are not expected to output one unless they print the answer to console.
- # Examples
- Assume all inputs are followed by a newline, and are all standard ASCII encoded.
- `abcdef` -> `fedcba`<br/>
- `Hello, World!` -> `!dlroW ,olleH`<br/>
- `racecar` -> `racecar`<br/>
- # Example program
- ```javascript
- function solution(x) {
- return x.split("").reverse().join("");
- }
- ```
- # Further clarifications
- No, you don't have to handle nulls correctly.
- Your goal is to reverse an ascii string.
- Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward.
- Function answers will not be given a newline, and are not expected to output one unless they print the answer to console.
- # Examples
- Assume all inputs are followed by a newline, and are all standard ASCII encoded.
- `abcdef` -> `fedcba`<br/>
- `Hello, World!` -> `!dlroW ,olleH`<br/>
- `racecar` -> `racecar`<br/>
- # Example program
- ```javascript
- function solution(x) {
- return x.split("").reverse().join("");
- }
- ```
- # Further clarifications
- - No, you don't have to handle nulls correctly.
- - Nor empty inputs.
#3: Post edited
- Your goal is to reverse an ascii string.
Given a newline terminated input, output your input in reverse order (minus the newline), followed by a newline. Terminate afterward.Function answers will not be given a newline, and are not expected to output one unless they print the answer.- # Examples
- Assume all inputs are followed by a newline, and are all standard ASCII encoded.
- `abcdef` -> `fedcba`<br/>
- `Hello, World!` -> `!dlroW ,olleH`<br/>
- `racecar` -> `racecar`<br/>
- # Example program
- ```javascript
- function solution(x) {
- return x.split("").reverse().join("");
- }
- ```
- # Further clarifications
- - No, you don't have to handle nulls correctly.
- Your goal is to reverse an ascii string.
- Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward.
- Function answers will not be given a newline, and are not expected to output one unless they print the answer to console.
- # Examples
- Assume all inputs are followed by a newline, and are all standard ASCII encoded.
- `abcdef` -> `fedcba`<br/>
- `Hello, World!` -> `!dlroW ,olleH`<br/>
- `racecar` -> `racecar`<br/>
- # Example program
- ```javascript
- function solution(x) {
- return x.split("").reverse().join("");
- }
- ```
- # Further clarifications
- - No, you don't have to handle nulls correctly.
#2: Post edited
- Your goal is to reverse an ascii string.
- Given a newline terminated input, output your input in reverse order (minus the newline), followed by a newline. Terminate afterward.
- Function answers will not be given a newline, and are not expected to output one unless they print the answer.
- # Examples
- Assume all inputs are followed by a newline, and are all standard ASCII encoded.
- `abcdef` -> `fedcba`<br/>
- `Hello, World!` -> `!dlroW ,olleH`<br/>
- `racecar` -> `racecar`<br/>
- # Example program
- ```javascript
- function solution(x) {
- return x.split("").reverse().join("");
- }
```
- Your goal is to reverse an ascii string.
- Given a newline terminated input, output your input in reverse order (minus the newline), followed by a newline. Terminate afterward.
- Function answers will not be given a newline, and are not expected to output one unless they print the answer.
- # Examples
- Assume all inputs are followed by a newline, and are all standard ASCII encoded.
- `abcdef` -> `fedcba`<br/>
- `Hello, World!` -> `!dlroW ,olleH`<br/>
- `racecar` -> `racecar`<br/>
- # Example program
- ```javascript
- function solution(x) {
- return x.split("").reverse().join("");
- }
- ```
- # Further clarifications
- - No, you don't have to handle nulls correctly.
#1: Initial revision
Reverse an ASCII string
Your goal is to reverse an ascii string. Given a newline terminated input, output your input in reverse order (minus the newline), followed by a newline. Terminate afterward. Function answers will not be given a newline, and are not expected to output one unless they print the answer. # Examples Assume all inputs are followed by a newline, and are all standard ASCII encoded. `abcdef` -> `fedcba`<br/> `Hello, World!` -> `!dlroW ,olleH`<br/> `racecar` -> `racecar`<br/> # Example program ```javascript function solution(x) { return x.split("").reverse().join(""); } ```