please write complete the script given in ./src/palindrome.js
so that it returns true
if the word is a plindrome and false
if it is not
the cases described below are tested in the palindrome.spec.js
which can be run by npm test
and should
any sequence of numbers or letters that contain the same letters or numbers read forward or reverse is considered a palindrome. Case of the letters do not matter
e.g.
abccba
is a palindrome andpalindrome('abccba')
should returntrue
Racecar
is a palindrome andpalindrome('Racecar')
should returntrue
1221
is a plaindrome andpalindrome('1221')
should returntrue
1234
is not a plaindrome andpalindrome('1234')
should returnfalse
Whatever
is not a plaindrome andpalindrome('1234')
should returnfalse
a string is even considered a palindrome, even if spaces or any non-word characters are injected
Abc Cba
is a palindrome#!Race Car?
is a palindrome1.221
is a palindromeF#cking Gnikcf!!!
is a palindrome#qwe!!!
is not a palindrome
- clone this project
- run
npm install
in the root directory - happy coding
- run
npm run test
and see if some test fails, if yes, go back to 3. (or fix the tests ;)