Created
June 29, 2020 14:10
-
-
Save joefearnley/9f06cc7ff602e441b95461baf90b4cf8 to your computer and use it in GitHub Desktop.
The 10-Day JS Challenge - Day 5: Case Insensitive Palindrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const caseInsensitivePalindrome = str => str.toLowerCase() === str.split('').reverse().join('').toLowerCase(); | |
describe('caseInsensitivePalindrome()', () => { | |
it('returns true for a case insensitive palindrome', () => { | |
// arrange | |
const str = 'AaBaa'; | |
// act | |
const result = caseInsensitivePalindrome(str); | |
// log | |
console.log("result 1: ", result); | |
// assert | |
expect(result).toBe(true); | |
}); | |
it('returns false when not a case insensitive palindrome', () => { | |
// arrange | |
const str = 'abac'; | |
// act | |
const result = caseInsensitivePalindrome(str); | |
// log | |
console.log("result 2: ", result); | |
// assert | |
expect(result).toBe(false); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment