Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions exercises/reverse-string/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"exercise": "reverse-string",
"version": "1.0.0",
"comments": [
"If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string"
],
"cases": [
{
"description": "empty string",
"property": "reverse",
"input": "",
"expected": ""
},
{
"description": "a word",
"property": "reverse",
"input": "robot",
"expected": "tobor"
},
{
"description": "a capitalized word",
"property": "reverse",
"input": "Ramen",
"expected": "nemaR"
},
{
"description": "a sentence with punctuation",
"property": "reverse",
"input": "I'm hungry!",
"expected": "!yrgnuh m'I"
},
{
"description": "a palindrome",
"property": "reverse",
"input": "racecar",
"expected": "racecar"
}
]
}
5 changes: 5 additions & 0 deletions exercises/reverse-string/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Reverse a string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short description is good 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, short and to the point!


For example:
input: "cool"
output: "looc"
5 changes: 5 additions & 0 deletions exercises/reverse-string/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
blurb: "Reverse a string"
title: "reverse-string"
source: "Introductory challenge to reverse an input string"
source_url: "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb"