Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isPangram(str) {
- const input = str.replace(/[^\w]/g, '').toLowerCase().split('');
- return [...new Set(input)].length === 26;
- }
- console.log(isPangram('Sphinx of black quartz, judge my vow.'));
- /*A pangram is a sentence that contains every single letter of the alphabet at least once.
- For example, the sentence 'The quick brown fox jumps over the lazy dog' is a pangram, because it uses the letters A-Z at least once (case is irrelevant).
- Create a function that accepts a string and detects whether or not it is a pangram. Return true if is a pangram, otherwise, return false.
- The function should ignore numbers and punctuation.
- Examples:
- isPangram('abcdefghijklmnopqrstuvwxyz') === true
- isPangram('Sphinx of black quartz, judge my vow.') === true
- isPangram('AbCdEfGhIjKlMzxWvUtSrQpOn') === false // 'y' is missing
- isPangram('Detect Pangram') === false */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement