🚀 Using Local Storage API (JavaScript) The Local Storage API provides methods for setting, getting, and removing data. `localStorage.setItem(key, value)` stores a key-value pair, `localStorage.getItem(key)` retrieves the value associated with a key, and `localStorage.removeItem(key)` removes a key-value pair. `localStorage.clear()` removes all data stored in Local Storage for the origin. The values are stored as strings, so you may need to use `JSON.stringify()` and `JSON.parse()` to store and retrieve complex data structures. #JavaScript #WebDev #Frontend #JS #professional #career #development
Local Storage API: Setting, Getting, and Removing Data
More Relevant Posts
-
𝐄𝐯𝐞𝐧𝐭 𝐋𝐨𝐨𝐩 𝐢𝐧 𝐉𝐚𝐯𝐚𝐒𝐜𝐫𝐢𝐩𝐭: So event loop is javascript is a mechanism that handles async operations by moving tasks from queue to call stack when it is empty. 𝐒𝐨 𝐰𝐡𝐲 𝐭𝐡𝐞 𝐡𝐞𝐜𝐤 𝐢𝐭 𝐞𝐯𝐞𝐧 𝐞𝐱𝐢𝐬𝐭?? JavaScript is single threaded. So it can run one thing at a time.But we as a developers still do: API calls,setTimeout,Promises. So,event loop helps managing these async tasks. 𝐂𝐨𝐫𝐞 𝐂𝐨𝐧𝐜𝐞𝐩𝐭𝐬: Call Stack:Where code executes,LIFO Web APIs(Browser): Handles async tasks(setTimeout,fetch,etc) Callback Queue(Macrotask Queue): Stores callbacks from setTimeout,setInterval. Microtask Queue : Stores Promise callbacks (.then,catch,await) Event Loop: Moves tasks to stack when it's empty 𝐄𝐱𝐚𝐦𝐩𝐥𝐞: console.log("Start"); setTimeout(()=>{ console.log("Timeout"); }) Promise.resolve().then(()=>{ console.log("Promise") }) console.log("End"); Console log : Start ,End , Promise , Timeout Start → sync → printed setTimeout → goes to Web API Promise → goes to microtask queue End → sync → printed Now stack is empty. Event loop runs: Microtasks → Promise Macrotasks → Timeout #reactjs #reactinterview #react18 #frontendjobs #ReactJS #Node #Frontend #InterviewPreparation #JavaScript #FullStack #WebDevelopment #SoftwareEngineer #Learning #Hiring #Jobs #FresherJobs #TechTalks #Software #MERN #Frontend #JavaScript #React #CodingInterview #SoftwareEngineering #WebDevelopment
To view or add a comment, sign in
-
Let's dive into a common concept in JavaScript called promises. ❓ What is a promise? A promise is an object that represents the eventful result of an asynchronous operation,either success or failure. Let's think of an non-technical example: 💡 Food order in a restaurant: You place an order ---> pending Food arrives ---> resolved(fulfiled) Order failes--->rejected 💡 Basic Promise example: 𝙘𝙤𝙣𝙨𝙩 𝙥𝙧𝙤𝙢𝙞𝙨𝙚 = 𝙣𝙚𝙬 𝙋𝙧𝙤𝙢𝙞𝙨𝙚((𝙧𝙚𝙨𝙤𝙡𝙫𝙚,𝙧𝙚𝙟𝙚𝙘𝙩) => { 𝙘𝙤𝙣𝙨𝙩 𝙨𝙪𝙘𝙘𝙚𝙨𝙨 = 𝙩𝙧𝙪𝙚; 𝙞𝙛(𝙨𝙪𝙘𝙘𝙚𝙨𝙨) { 𝙧𝙚𝙨𝙤𝙡𝙫𝙚("𝘿𝙖𝙩𝙖 𝙛𝙚𝙩𝙘𝙝𝙚𝙙"); } 𝙚𝙡𝙨𝙚 { 𝙧𝙚𝙟𝙚𝙘𝙩("𝙀𝙧𝙧𝙤𝙧 𝙤𝙘𝙘𝙪𝙧𝙧𝙚𝙙"); } }); 💡 In Modern way we can handle/resolve a promise is using async/await: 𝐚𝐬𝐲𝐧𝐜 𝐟𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝐟𝐞𝐭𝐜𝐡𝐃𝐚𝐭𝐚() { 𝐭𝐫𝐲 { 𝐜𝐨𝐧𝐬𝐭 𝐫𝐞𝐬𝐮𝐥𝐭 = 𝐚𝐰𝐚𝐢𝐭 𝐩𝐫𝐨𝐦𝐢𝐬𝐞; 𝐜𝐨𝐧𝐬𝐨𝐥𝐞.𝐥𝐨𝐠(𝐫𝐞𝐬𝐮𝐥𝐭); } 𝐜𝐚𝐭𝐜𝐡 (𝐞𝐫𝐫𝐨𝐫) { 𝐜𝐨𝐧𝐬𝐨𝐥𝐞.𝐥𝐨𝐠(𝐞𝐫𝐫𝐨𝐫); } } ⏯️ Use cases: 1)API calls 2) setTimeout/async tasks 3)parallel operations 4)file upload/download 5)database calls #reactjs #reactinterview #react18 #frontendjobs #ReactJS #Node #Frontend #InterviewPreparation #JavaScript #FullStack #WebDevelopment #SoftwareEngineer #Learning #Hiring #Jobs #FresherJobs #TechTalks #Software #MERN #Frontend #JavaScript #React #CodingInterview #SoftwareEngineering #WebDevelopment
To view or add a comment, sign in
-
One React trick that saved me hours last week: Instead of useState + useEffect to fetch data, try a custom hook. Before: 15 lines of messy fetch logic inside the component. After: One line — const { data, loading } = useProfile(userId) Clean. Reusable. Testable. This is the kind of thing that separates junior from mid-level React devs. Are you using custom hooks in your projects? Share your favorite one. #ReactJS #WebDevelopment #JavaScript #FrontendDeveloper #CodeTips
To view or add a comment, sign in
-
As a full stack developer, one question I kept seeing was: GraphQL or REST? So I broke it down properly. I just published my first technical article: GraphQL vs REST: A Practical Comparison for Full Stack Developers In it I cover: - What REST is and where it struggles - What GraphQL is and how it solves over-fetching and under-fetching - A real-world scenario showing both side by side - When to use each one in production If you're a developer who has ever made 3 API calls just to render one screen, this one is for you. Read it here: https://lnkd.in/eHBrPYxG #GraphQL #REST #WebDevelopment #FullStack #JavaScript #TechnicalWriting #NodeJS #React #SoftwareEngineering
To view or add a comment, sign in
-
-
🚨 Most developers use Fetch… but still get it wrong Not because it’s hard— but because of ONE hidden detail 👇 👉 Fetch does NOT fail on HTTP errors So even if your API returns: ❌ 404 ❌ 500 Your code still runs like everything is fine 😬 💡 The fix? Always check res.ok before using the data 🔥 Key takeaway: Fetch = Promise-based NOT = automatic error handling This tiny mistake can break real apps Save this before your next interview 🚀 Have you run into this before? 👇 #JavaScript #Frontend #WebDevelopment #CodingTips #Developers
To view or add a comment, sign in
-
-
Ever wondered how everything on the web comes together? Here’s a quick breakdown: 🔹 Frontend — What users see (HTML, CSS, JavaScript) 🔹 Frameworks — Build smarter UIs (React / Vue) 🔹 Backend — Logic & processing (Node.js, Express) 🔹 Database — Where data lives (MySQL / MongoDB) 🔹 APIs — The bridge that connects it all Understanding these layers is the first step toward becoming a solid developer. 💡 Whether you're just starting or brushing up your basics, mastering the fundamentals always pays off. #WebDevelopment #Frontend #Backend #FullStack #JavaScript #Coding #Tech #Developers
To view or add a comment, sign in
-
-
🚀 𝗡𝗼𝗱𝗲.𝗷𝘀 𝘃𝘀. 𝗘𝘅𝗽𝗿𝗲𝘀𝘀.𝗷𝘀 — 𝗞𝗻𝗼𝘄 𝘁𝗵𝗲 𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲! A common question for those starting with backend development: "Should I use Node or Express?" The truth is, it’s not an "Either/Or"—it’s an "And." 👉 The Engine vs. The Toolkit 🛠️ 𝗡𝗼𝗱𝗲.𝗷𝘀 𝗶𝘀 𝘁𝗵𝗲 𝗘𝗻𝗴𝗶𝗻𝗲 It’s the JavaScript runtime built on Chrome's V8 engine. It allows you to run JavaScript outside the browser. Think of it as the powerhouse that handles your server-side logic. 🧰 𝗘𝘅𝗽𝗿𝗲𝘀𝘀.𝗷𝘀 𝗶𝘀 𝘁𝗵𝗲 𝗧𝗼𝗼𝗹𝗸𝗶𝘁 It’s a minimal and flexible framework built on top of Node.js. It simplifies things like routing, middleware, and handling HTTP requests. 𝗪𝗵𝘆 𝘄𝗲 𝘂𝘀𝗲 𝘁𝗵𝗲𝗺 𝘁𝗼𝗴𝗲𝘁𝗵𝗲𝗿: While you can build a server using just Node.js (with the http module), it requires a lot of manual code. Express turns 50 lines of "pure" Node code into 5 lines of readable, maintainable logic. 𝗠𝘆 𝗧𝗮𝗸𝗲: In 2026, efficiency is everything. Unless you are building something extremely low-level, Express (or similar frameworks like Fastify) is the standard for getting high-performance APIs into production quickly. 𝗪𝗵𝗶𝗰𝗵 𝗼𝗻𝗲 𝗮𝗿𝗲 𝘆𝗼𝘂 𝗹𝗲𝗮𝗿𝗻𝗶𝗻𝗴/𝘂𝘀𝗶𝗻𝗴 𝗿𝗶𝗴𝗵𝘁 𝗻𝗼𝘄? 𝗟𝗲𝘁’𝘀 𝘁𝗮𝗹𝗸 𝘁𝗲𝗰𝗵 𝗯𝗲𝗹𝗼𝘄! 👇 #NodeJS #ExpressJS #BackendDevelopment #JavaScript #WebDevelopment #Coding #SoftwareEngineering #TechInsights
To view or add a comment, sign in
-
-
🚀 Immutability in Functional JavaScript Immutability is the principle of not modifying data after it's created. Instead of changing existing objects or arrays, we create new ones with the desired modifications. This prevents unexpected side effects and makes it easier to track data changes over time. JavaScript provides tools like `Object.assign`, the spread operator (`...`), and libraries like Immutable.js to help manage immutability. #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
The React pattern that eliminated 80% of my useEffect calls Most useEffect calls are just bad data derivation. Here is the derived state pattern that cleaned up years of accumulated complexity in my React components. Full breakdown (6 min read) → https://lnkd.in/gsS5RKC4 #ReactJS #Frontend #JavaScript #TypeScript #WebDev #UIEngineering
To view or add a comment, sign in
-
-
The modern web runs on powerful technologies. From HTML, CSS, and JavaScript to React, Node.js, and MongoDB, this stack forms the foundation of real-world applications. Master it, and you unlock endless opportunities in tech. 🚀 #webdevelopment #mernstack #learncoding #javascript #techskills
To view or add a comment, sign in
-
More from this author
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development