Skip to content
Open
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
7 changes: 6 additions & 1 deletion src/is_palindrome.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const isPalindrome = function (text) {
let textReversed = text.reverse();

};
if(textReversed == text){
return true;
} else {
return false;
}};

module.exports = isPalindrome;

17 changes: 16 additions & 1 deletion src/is_pangram.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
const isPangram = function(text) {
// change input text to lower case

text.toLowerCase()

//all alphabet letters
let letters = "abcdefghijklmnopqrstuvwxyz".split('');

};

//check if all letters are included
for(let letter of letters){
if(!text.includes(letter)){
return false
}
}

return true

};
module.exports = isPangram;
43 changes: 21 additions & 22 deletions test/is_pangram.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,53 @@ describe('isPangram()', () => {
// Arrange
const text = 'the quick brown fox jumps over the lazy dog';

// Act

// Assert
// Act, Assert
expect(isPangram(text)).toBeTruthy();
});

test('works with "abcdefghijklmnopqrstuvwxyz"', () => {
// Arrange
const text = "abcdefghijklmnopqrstuvwxyz";

// Act

// Assert
// Act, Assert
expect(isPangram(text)).toBeTruthy();

});

test("missing character 'x'", () => {
// Arrange
const text = "abcdefghijklmnopqrstuvwyz";

// Act

// Assert
// Act, Assert
expect(isPangram(text)).toBeFalsy();

});

test('empty sentence', () => {
// Arrange
const text = "";

// Act

// Assert

// Act, Assert
expect(isPangram(text)).toBeFalsy();

});

test('pangram with underscores instead of spaces works', () => {
// Arrange

// Act
// Arrrange
const text = 'the quick_brown fox jumps over the lazy_dog';

// Assert
// Act, Assert
expect(isPangram(text)).toBeTruthy();

});

test('pangram with numbers', () => {
// Arrange

// Act

// Assert
// Arrrange
const text = 'the 1 quick brown fox jumps 2 over the lazy dog';

// Act, Assert
expect(isPangram(text)).toBeTruthy();

});

// Write your own test case
Expand Down