Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

86%
+11 −0
Challenges Reverse an ASCII string

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...

32 answers  ·  posted 3y ago by moony‭  ·  last activity 9mo ago by qwr‭

Question code-golf
#4: Post edited by user avatar moony‭ · 2020-11-30T23:52:52Z (over 3 years ago)
  • 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 by user avatar moony‭ · 2020-11-30T23:42:46Z (over 3 years ago)
  • 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 by user avatar moony‭ · 2020-11-30T23:27:53Z (over 3 years ago)
  • 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 by user avatar moony‭ · 2020-11-30T21:09:09Z (over 3 years ago)
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("");
}
```