Check word score in a string
// Capital letter - 1
// small letter - 2
// number - 3
// spl char - 4
let str = "l. lorem ip 123";
let str1 = "skdfh skdfh alsjdhf KJHGH24 ksdhfksfh";
let arrayStr = str1.split(" ");
let obj = {}
function checkCase(ch) {
if (!isNaN(ch * 1)){
return 3;
} else if (ch === ch.toUpperCase()) {
return 1;
} else if (ch === ch.toLowerCase()){
return 2;
} else {
return 4
}
}
function checkScoreofString(arrayStr) {
let newString = "";
for(let i=0; i<arrayStr.length; i++) {
let splittedString = arrayStr[i].split("");
let countWord = 0;
for(let j=0; j<splittedString.length; j++) {
countWord += checkCase(splittedString[j])
}
countWord > 10 ? newString += arrayStr[i] + " " : '';
console.log(newString)
}
}