🚀 30 Days of JavaScript – Day 16 Starting to build more structured programs using JavaScript. 💡 Today’s Project: Contact Manager This program allows users to: • Add contacts (name & phone) • View stored contacts 🧠 Concepts Used: • functions • arrays of objects • oops • menu-driven logic This helped me understand how to organize code into reusable functions. 🎥 Demo below 👇 Full source code in the First comment. #JavaScript #WebDevelopment #CodingJourney #LearningJavaScript #ProblemSolving

let contacts = []; // function to add contact function addContact() {   let name = prompt("Enter name:");   let phone = prompt("Enter phone number:");   contacts.push({ name: name, phone: phone });   alert("Contact added!"); } // function to view contacts function viewContacts() {   let list = "Contact List:\n";   for (let i = 0; i < contacts.length; i++) {     list += contacts[i].name + " - " + contacts[i].phone + "\n";   }   alert(list); } let running = true; while (running) {   let choice = prompt(     "Contact Manager\n" +     "1. Add Contact\n" +     "2. View Contacts\n" +     "3. Exit\n" +     "Enter choice:"   );   if (choice === "1") {     addContact();   }   else if (choice === "2") {     viewContacts();   }   else if (choice === "3") {     running = false;     alert("Goodbye!");   }   else {     alert("Invalid option");   } }

Like
Reply

To view or add a comment, sign in

Explore content categories