codealong og oppgave

This commit is contained in:
Geir Okkenhaug Jerstad 2024-11-01 14:45:13 +01:00
parent cf77bca4e0
commit 1e04ea8aa3
5 changed files with 99 additions and 53 deletions

22
oppgaver/checkLetters.js Normal file
View 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);