Skip to content

Instantly share code, notes, and snippets.

View emtiazahmed27's full-sized avatar
🐢
Not running but crawling indeed

Emtiaz Ahmed emtiazahmed27

🐢
Not running but crawling indeed
View GitHub Profile
@emtiazahmed27
emtiazahmed27 / checkPalindrome.js
Last active July 1, 2022 00:06
ICBatch05-FinalExam (Problem Solving)
//write a function that checks whether an input is palindrome or not.
function check(input){
if(isNaN(input)){
const len = input.length;
for (let i = 0; i < len / 2; i++) {
if (input[i] !== input[len - 1 - i]) return false;
}
return true;
}
else {
@emtiazahmed27
emtiazahmed27 / wordCount.js
Last active June 30, 2022 23:43
ICBatch05-FinalExam (Problem Solving)
//Write a function that counts words in a String
function wordCount(str){
let arr=str.split(" ");
return arr.filter((word)=>word!="").length;
}
console.log(wordCount("javaScript exam e bash khabo please wish me luck "));
console.log(wordCount("javaScript exam e bash khabo please wish me luck"));
//output: 9
@emtiazahmed27
emtiazahmed27 / truncateLetters.js
Last active June 30, 2022 23:42
ICBatch05-FinalExam (Problem Solving)
//write a function that truncates "a", "z", "c"
function truncate(str){
let str2=str.toLowerCase();
let res="";
for(let i=0; i<str2.length; i++){
if(str2[i]=="c"|| str2[i]=="a"||str2[i]=="z") res+="";
else res+=str2[i];
}
return res;
}