🚀 30 Days of JavaScript – Day 4 Continuing my journey to improve JavaScript logical thinking by building small programs every day. 💡 Today’s Program: Vowel Identifier & Replacement This program: i) Takes a name as input ii) Identifies vowels (a, e, i, o, u) iii) Replaces vowels with * iv) Counts the total number of vowels in the name 🧠 Concepts Used: prompt() for user input for loop for iteration toLowerCase() for case handling includes() method Conditional logic (if / else) Example: Input → john Output → j*hn Total Vowels → 1 🎥 Demo below 👇 Full source code in the first comment. #JavaScript #WebDevelopment #CodingJourney #ProblemSolving #LearningJavaScript #30DaysOfCode

let name = prompt("Enter your name:"); let vowelCount = 0; let result = ""; for (let i = 0; i < name.length; i++) {     let ch = name[i].toLowerCase();     if ("aeiou".includes(ch)) {         vowelCount++;         result += "*";     } else {         result += name[i];     } } console.log("Replaced Name:", result); console.log("Total Vowels:", vowelCount);

Like
Reply

To view or add a comment, sign in

Explore content categories