Soumen Sarkar’s Post

💡 JavaScript Tip of the Day Want to update a specific object value from an API response? Here’s a clean and modern way to do it using async/await and .map() 👇 const fetchData = async () => { const response = await fetch("https://lnkd.in/gQTYNBSX"); const data = await response.json(); const updatedData = data.map((user) => user.name === "Ervin Howell" ? { ...user, username: "Sarkar" } : user ); console.log(updatedData); }; fetchData(); 🧠 Why it’s useful: Makes async operations clean and readable Keeps data immutable using object spread { ...user } Updates only what’s needed — nothing more A simple yet powerful approach to handle dynamic data updates! 🚀 hashtag #JavaScript hashtag #WebDevelopment hashtag #FrontendDeveloper hashtag #AsyncAwait hashtag #CodingTips hashtag #WebDev hashtag #UIDeveloper hashtag #ReactJS

  • text

To view or add a comment, sign in

Explore content categories