🚀 30 Days of JavaScript – Day 5 Continuing my journey to improve my JavaScript logical thinking by building small programs every day. 💡 Today’s Program: Reverse a String This program takes a word from the user and reverses it using a loop. 🧠 Concepts Used: • for loop • string indexing • basic string manipulation Example: Input → JavaScript Output → tpircSavaJ 🎥 Demo below 👇 Full source code in the First comment. #JavaScript #CodingJourney #ProblemSolving #WebDevelopment #Learning

let input = prompt("Enter a word to reverse:"); if (input) {   let word = input.trim();   let reversed = "";   for (let i = word.length - 1; i >= 0; i--) {     reversed += word[i];   }   console.log("Original Word:", word);   console.log("Reversed Word:", reversed); } else {   console.log("No word entered."); }

Like
Reply

To view or add a comment, sign in

Explore content categories