Simulating Friend Request Delay using JavaScript (SetTimeout & DOM): I’m excited to share another small project I built while practicing JavaScript DOM manipulation and asynchronous behavior. In this project, when the “Add Friend” button is clicked, the request is not accepted instantly. Instead, it waits for 5 seconds (5000ms) before updating the status from “Stranger” to “Friend.” Similarly, when “Remove Friend” is clicked, it again takes 5 seconds before updating the status back from “Friend” to “Stranger.” This small interaction simulates how real-world applications process requests with delays, such as sending friend requests or processing server responses. Key concepts I practiced in this project: 1.) DOM Manipulation – Dynamically updating text, button labels, and styles 2.) Event Handling – Triggering UI changes using button click events 3.) SetTimeout() – Introducing a delay before executing an action 4.) UI State Management – Maintaining consistent UI changes during interactions Through this project, I clearly understood how SetTimeout() works in JavaScript and also strengthened my knowledge of DOM manipulation and interactive UI behavior. Building small projects like this helps me improve my problem-solving skills and JavaScript fundamentals step by step. Feedbacks and suggestions are always welocme! #JavaScript #DOMManipulation #SetTimeout #FrontendDevelopment #WebDevelopment #JavaScriptProjects #CodingJourney #LearningByDoing #BeginnerDeveloper #WebInteraction

To view or add a comment, sign in

Explore content categories