codealong og oppgave
This commit is contained in:
parent
cf77bca4e0
commit
1e04ea8aa3
5 changed files with 99 additions and 53 deletions
22
oppgaver/checkLetters.js
Normal file
22
oppgaver/checkLetters.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const letters = "abcdefghijklmnopqrstuvwxzy ";
|
||||
let string = "Not a pangram";
|
||||
let string2 = "The quick brown fox jumps over the lazy dog"
|
||||
|
||||
// console.log(letters, string,letterArray, stringArray,test)
|
||||
|
||||
|
||||
|
||||
function isPangram(str) {
|
||||
const lowerStr = str.toLowerCase();
|
||||
|
||||
if (letters.split('').every(char => lowerStr.includes(char))){
|
||||
console.log('ja')
|
||||
return true;
|
||||
|
||||
} else {
|
||||
console.log('nei')
|
||||
return false
|
||||
};
|
||||
}
|
||||
|
||||
isPangram(string2);
|
Loading…
Add table
Add a link
Reference in a new issue