100 Days of JavaScript Coding Challenges || Day #13

preview_player
Показать описание
Welcome, on a 100-day JavaScript journey with me! Join me as I tackle a new coding challenge every day, exclusively using JavaScript. Let's level up our skills together, one problem at a time.

-------------------------------------------------------
📢 Checkout our world best JavaScript Course Part 1 & 2 👇

--------------------------------------------------------
Before Learning JavaScript, Don't forget to watch 👇

-----------------------------------------------------
✌️ Become Member, get access to perks, free Source code, & more..

-----------------------------------------------------

⌚ TIMELINE ⌚
Рекомендации по теме
Комментарии
Автор

React Series will be start from May, after v19 will be stable 😀 ❤

ThapaTechnical
Автор

split method ko itne baar use kr liya hai n ki ab koi bhul he nhi sakta. sir your teaching way is excellent . thanku so much sir🙏✌🙌

priyakarn
Автор

JavaScript Challenge 100/13 days is Completed ✅👍

BhagatBhutale..
Автор

Nice video.. ! Here is my logic -- let str = 'Check Vowel';
function getCount(str){
const vowels = [ 'a', 'e', 'i', 'o', 'u'];

return str.toLowerCase().split("").reduce((acc, char) =>{
return vowels.includes(char) ? acc + 1 : acc
}, 0)
}; // Output - 3

javascriptvros
Автор

this siries help me to gain confidance abhi tk sare mene khud se kiye hai

Goutamwaghe
Автор

//? Question: Write a function that takes a string as input and returns the count of vowels in that string. Consider 'a', 'e', 'i', 'o' and 'u' as vowels (both lowercase and upppercase).

//* Solution 1:
// const countVowels = (str) => {
// const vowels = ["a", "e", "i", "o", "u"];
// const strArr = str.toLowerCase().split("");

// return strArr.reduce((acc, currVal) => {
// vowels.includes(currVal) ? acc++ : acc;

// return acc;
// }, 0);
// };

//* Solution 2:
const countVowels = (str) => {
const vowels = ["a", "e", "i", "o", "u"];
const strArr = str.split("");
let count = 0;

for (let char of strArr) {
if {
count++;
}
}

return count;
};

//* Example usage:
world")); // 4
console.log(countVowels("ThE quIck brOwn fox")); // 5
// 0

//* Constraints:

//* The input string may contain letters in both uppercase and lowercase.
//* The output should be a non-negative integer representing the count of vowels in the input string.

theboss
Автор

const countVowels = (str) =>{
let count = 0;
let vowels = 'aeiouAEIOU'

for (let i =0;i <str.length;i++){
if( vowels.includes(str[i])){
count = count +1;
}

}
console.log(count)


}
countVowels("kISAN")
countVowels("YOUUU")

k-hpoy
Автор

and we can also go with this:)

function countVowels(str){
let vowels = new Set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']);
let count = 0;

for(let char of str){
if(vowels.has(char)){
count ++;
}
}
return count;
}
const output = countVowels("Hello java and javascript");
console.log("The counted vowels are in string: ", output);

Aakash_Kashyap
Автор

const countVowels = (str) =>{
let count = 0;
const vowels = ['a', 'e', 'i', 'o', 'u']
const arr = str.split('');
arr.map((cur)=>{

})
return count
}
world'))

subhaprakashnayak
Автор

const countVowel = (string) => {
let vowel = 0
for (const iterator of string) {
if (iterator === "a" || iterator === "e" || iterator === "i" || iterator === 'u') {
vowel += 1
}
}
console.log(vowel)
}

countVowel('Ishan Singh')

IshanSingh
Автор

const string = "Hello world";
const vowels = ["A", "E", "I", "O", "U"];

const findVowels = (str) => {
var count = 0;

str = str.toUpperCase().split("");
for (let i = 0; i < str.length; i++) {
if (vowels.includes(str[i])) {
count++;
}
}

return count;
};


gyanendra-jay-bhim
Автор

function countVowels(str) {
const vowels = ["a", "e", "i", "o", "u"];

str = [...str];
let count = 0;
str.map((i) => {
if {
count = count + 1;
}
});
return count;
}

world"));

MDTalha-vtbi
Автор

const vowels = ["a", "e", "i", "o", "u"];
const lowerCaseStr = str.toLowerCase();
const data = lowerCaseStr.split("");

return data.filter((letter) =>

shrawankumar
Автор

function countVowels(str){

let count = 0;
let data = str.toLowerCase();
for(let char of data){
if(char === 'a' || char === 'e' || char === 'i' ||
char === 'o' || char === 'u')
count++;
}
return count;
}
const output = countVowels("Hello world");
console.log("Result is: "+output);

Aakash_Kashyap
Автор

function countVowels(str) {
let vCount = 0
for (const element of str) {
if (element === "a" ||element === "e" ||element === "i" ||element === "o" ||element === "u" ||element === "A" ||element === "E" ||element === "I" ||element === "O" || element === "U") {
vCount++
}
}
console.log(vCount)
}
countVowels("ThE QuIck BrOwn FOx") // Output : 5

mahuKhaLnaYak
Автор

You can solve this question without using includes method

const countVowels = (str) =>{
let vowels = ['a', 'e', 'i', 'o', 'u']

let arr = str.split("");
console.log(arr)
let count = 0;
for(let i = 0; i< vowels.length; i++)
{
for(let j = 0; j < arr.length; j++)
{
if(vowels[i] === arr[j])
{
count++;
}
}
}
return count;

because at the time of interview built in method nhi lagvate hai

shobitkhatri
Автор

Day # 13
Present Sir ! Love and Respect from Pakistan.

// Day 13
// Write a program in JavaScript in which create a function named countVowels() in that string.

let str = prompt("Enter a string: ").toLowerCase();

let vowels_count = 0;

function countVowels(a) {
let vowels = "";
for (let i = 0; i < a.length; i++) {
if (
str[i] == "a" ||
str[i] == "e" ||
str[i] == "i" ||
str[i] == "o" ||
str[i] == "u"
) {
vowels += a[i];
vowels_count += 1;
}
}
return vowels;
}

console.log(
`The vowels in the string ${str} are: ${countVowels(str).split(
""
)} & the count of vowels is: ${vowels_count} `
);

owaisnadeem
Автор

Next Challenge🔥🔥 lao detect capital letter in string ❤❤❤❤❤❤

Chirag
Автор

function countV(p) {
const v = ["a", "e", "i", "o", "u"];
const pp = p.split("");
let count = 0;
pp.map(i => {
v.map(vi => {
if(i.includes(vi)) {
count++;
}
});
});

return count;
}
countV('Hassam'); // 2

its worked, but 2 loops.

HassamUlHaq-reyx
Автор

const vowels = (data) => {
let count = 0;
for (var i = 0; i < data.length; i++) {
data[i] == "a" ||data[i] == "e" ||data[i] == "i" ||data[i] == "o" ||data[i] == "u"? count++: 0;
}
return count;
};

console.log(vowels("sahil")); #mysolution

MdSahil-gxf
join shbcf.ru