8000 added palindromes exercise · CalWal/javascript-exercises@f04a440 · GitHub
[go: up one dir, main page]

Skip to content

Commit f04a440

Browse files
committed
added palindromes exercise
1 parent b847c3b commit f04a440

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

palindromes/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Exercise XX - palindromes
2+
3+
Write a function that determines whether or not a given string is a palindrome.
4+
5+
A palindrome is a string that is spelled the same both forwards and backwards, usually without considering punctuation or word breaks:
6+
7+
### some palindromes:
8+
- A car, a man, a maraca.
9+
- Rats live on no evil star.
10+
- Lid off a daffodil.
11+
- Animal loots foliated detail of stool lamina.
12+
- A nut for a jar of tuna.
13+
- A car, a man, a maraca.
14+
15+
```javascript
16+
palindromes('racecar') // true
17+
palindromes('tacos') // false
18+
```
19+
20+

palindromes/palindromes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var palindromes = function() {
2+
3+
}
4+
5+
module.exports = palindromes

palindromes/palindromes.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var palindromes = require('./palindromes')
2+
3+
describe('palindromes', function() {
4+
it('works with single words', function() {
5+
expect(palindromes('racecar')).toEqual(true);
6+
});
7+
xit('works with punctuation', function() {
8+
expect(palindromes('Racecar!')).toEqual(true);
9+
});
10+
xit('works with multiple words', function() {
11+
expect(palindromes('A car, a man, a maraca.')).toEqual(true);
12+
});
13+
xit('works with multiple words', function() {
14+
expect(palindromes('Animal loots foliated detail of stool lamina.')).toEqual(true);
15+
});
16+
xit('doesn\'t just always return true', function() {
17+
expect(palindromes('ZZZZ car, a man, a maraca.')).toEqual(false);
18+
});
19+
20+
});

0 commit comments

Comments
 (0)
0