Created
July 3, 2020 12:19
-
-
Save joefearnley/f717827eac718c245069be112adcbc99 to your computer and use it in GitHub Desktop.
The 10-Day JS Challenge - Day 9: 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 largestNumber = num => { | |
result = ''; | |
for(let i = 1; i <= num; i++) { | |
result += '9'; | |
} | |
return parseInt(result); | |
}; | |
describe('largestNumber()', () => { | |
it('returns largest positive integer possible for digit count - 2', () => { | |
const num = 2; | |
const result = largestNumber(num); | |
console.log("result: ", result); | |
expect(result).toBe(99); | |
}); | |
it('returns largest positive integer possible for digit count - 5', () => { | |
const num2 = 5; | |
const result2 = largestNumber(num2); | |
console.log("result: ", result); | |
expect(result2).toBe(99999); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment