🚀Day 4/100 – Understanding JSON & Fetch in JavaScript Today I focused on two fundamental concepts in modern web development: 1️⃣ JSON (JavaScript Object Notation) JSON is the standard format for sending data between a client and a server. Key things I reinforced today: Keys must be in double quotes Strings must use double quotes Numbers & booleans don’t need quotes JSON stores only data (no functions, no undefined) I practiced converting between objects and JSON: JSON.stringify() → Object ➝ JSON string JSON.parse() → JSON string ➝ Object Understanding this flow is critical because servers send data as JSON strings, and we convert them back into JavaScript objects to use in our applications. Data Flow: Server ➝ JSON String ➝ Parse ➝ JavaScript Object ➝ UI 2️⃣ Fetch API I learned how to retrieve data from an API using fetch(). Basic flow: Send request using fetch() Convert response using response.json() Use the data Also practiced the cleaner modern approach using async/await, which makes asynchronous code much more readable and scalable compared to chaining multiple .then() calls. What I Realized Today- If you don’t understand JSON and fetch deeply, you can’t properly build real-world applications. Every frontend app talks to a backend, and this is the bridge. On to Day 5. #100DaysOfCode #JavaScript #WebDev #API #JSON #CodingChallenge #Frontend #SoftwareEngineering #MERNStack #LearningEveryday
Mastering JSON & Fetch in JavaScript for Web Development
More Relevant Posts
-
Day 90 of me reading random and basic but important dev topicsss...... Today I read about the File Object in JavaScript As web applications become more robust, handling file uploads, drag-and-drop interfaces, and binary data is an absolute must for modern frontend development. What is a File? At its core, a File object is just a specific type of Blob (Binary Large Object) that is extended with filesystem-related capabilities. Because it inherits from Blob, it has access to all the same properties, but adds two crucial pieces of OS-level data: * name: The file name string (e.g. "profile.png"). * lastModified: The timestamp of the last modification (integer date). How do we get a File object? There are two primary ways we encounter files in the browser: 1. User Input (The Common Way) Most of the time, the OS provides this data when a user interacts with an <input type="file"> or a drag-and-drop interface. function handleUpload(input) { // input.files is an array-like object, as users can select multiple files let file = input.files[0]; console.log(`Name: ${file.name} | Modified: ${file.lastModified}`); } 2. The Constructor (The Programmatic Way) You can manually construct a file using: new File(fileParts, fileName, [options]) * fileParts: An array of Blob, BufferSource, or String values. * fileName: The name of your new file. * options: An optional object where you can pass a custom lastModified timestamp. Pro-Tip: Sending files to the backend is incredibly seamless. Modern network APIs like fetch and XMLHttpRequest natively accept File objects in their payload! You don't always have to parse them first. Keep Learning!!!! #JavaScript #WebDevelopment #Frontend #SoftwareEngineering #CodingTips
To view or add a comment, sign in
-
-
⚛️ React Performance Tip: Stop Recomputing on Every Render A common mistake in React is recalculating data on every render: ```javascript id="s7dh2k" const processedData = data.map(...); ``` ❌ This runs every time the component re-renders ❌ Leads to unnecessary computation and slower UI Instead, memoize it using `useMemo`: ```javascript id="k39xdl" const processedData = useMemo(() => { return data.map(...); }, [data]); ``` ✅ Runs only when `data` changes ✅ Prevents unnecessary recalculations ✅ Improves performance significantly 💡 Key takeaway: Use `useMemo` when: • Expensive computations • Large datasets • Avoiding repeated work 🚀 Small optimization = big performance boost What’s your go-to React performance trick? #ReactJS #JavaScript #Frontend #Performance #WebDevelopment #Coding
To view or add a comment, sign in
-
-
Does understanding JavaScript internals actually matter in "real life"? 🤔 Yesterday, I got my answer. 😅 I was booking movie tickets with friends. Seats were filling FAST. 🎟️🔥 I hit “Pay Now”... and the app started loading. My instinct? Panic. "Did it hang? Should I click again?" 😰 But I stopped myself. I remembered the Event Loop. While I stared at the spinner, JavaScript was juggling: 💳 The Call Stack processing my click. 🌐 Web APIs handling the payment request in the background. ⚡ The Callback Queue waiting to push the success message back to the UI. Because JS is non-blocking, the UI stayed "alive" even while the data was in transit. If I had clicked again, I might have triggered a double-charge or a race condition. Two seconds later? ✅ Payment Successful. > Sometimes, great engineering is invisible. It’s not just about writing code that works; it’s about understanding why it doesn't break under pressure. Don't just learn the syntax. Learn the engine. 🔁✨ Check out the diagram below notice how the 'Priority Queue' handles the logic while the 'Callback Queue' keeps the UI ready for the next move. That’s the secret sauce! #JavaScript #React #JavaScriptDeveloper #ReactjsDeveloper #Frontenddevelopment #SoftwareEngineering #Fullstackdeveloper
To view or add a comment, sign in
-
-
𝐌𝐕𝐂 𝐢𝐧 𝐄𝐱𝐩𝐫𝐞𝐬𝐬.𝐣𝐬 Today I finally got clarity on something that confused me for a long time — MVC architecture in backend development. Let me break it down in a way that actually makes sense 👇 𝑾𝒉𝒂𝒕 𝒊𝒔 𝑴𝑽𝑪? MVC stands for: - Model – Handles data (database, structure) - View – What user sees (EJS, HTML) - Controller – The brain 🧠 (logic + connection) 🔥 𝑹𝒆𝒂𝒍 𝑬𝒙𝒂𝒎𝒑𝒍𝒆 (𝑬𝒙𝒑𝒓𝒆𝒔𝒔.𝒋𝒔) When user opens a page: 1️⃣ Route receives request 2️⃣ Route calls the Controller 3️⃣ Controller processes data (Model) 4️⃣ Controller sends data to View (EJS) 5️⃣ View displays it to user 𝑾𝒉𝒚 𝑴𝑽𝑪 𝒎𝒂𝒕𝒕𝒆𝒓𝒔? ✔ Better code structure ✔ Easy debugging ✔ Scalable projects ✔ Industry standard 🔥 𝑲𝒆𝒚 𝑳𝒆𝒂𝒓𝒏𝒊𝒏𝒈 (𝑮𝒂𝒎𝒆 𝒄𝒉𝒂𝒏𝒈𝒆𝒓 𝒇𝒐𝒓 𝒎𝒆) Before: ❌ I was writing everything inside routes ❌ Code was messy & hard to manage Now: ✅ Routes → only handle URL ✅ Controllers → handle logic ✅ Views → handle UI 👉 Everything is clean, scalable, and easy to debug 𝑴𝒚 𝒕𝒂𝒌𝒆𝒂𝒘𝒂𝒚 Don’t mix everything in one place. Separate responsibilities — your future self will thank you. #MVC #ExpressJS #NodeJS #BackendDevelopment #WebDevelopment
To view or add a comment, sign in
-
-
🌐 Learning Frontend Day 14: JavaScript Data Types JavaScript data types are the building blocks of all logic in web development. They define how values are stored, manipulated, and interpreted. 🔑 Key Data Types in JS: Primitive Types String → "Hello World" Number → 42, 3.14 Boolean → true / false Null → intentional empty value Undefined → variable declared but not assigned Symbol → unique identifiers BigInt → large integers beyond Number limits Non-Primitive (Reference) Types Object → collections of key-value pairs Array → ordered lists [1,2,3] Function → reusable blocks of code #FrontendDevelopment #JavaScript #WebDevelopment #LearningJourney #CodingLife #100DaysOfCode #TechSkills #DeveloperCommunity #JSBasics #CodeNewbie
To view or add a comment, sign in
-
-
🚀 Where to Use Spread (...) and Rest (...) Operators in JavaScript (Real Use Cases) Many developers know spread and rest… But the real question is 👉 Where should you actually use them? 🔹 Spread Operator (...) → “Expand Values” 👉 Use spread when you want to open / copy / merge data 1. Copy Arrays (Avoid Bugs) const arr = [1, 2, 3]; const copy = [...arr]; 👉 Without spread: const copy = arr; // ❌ same reference (danger) 2. Merge Arrays const a = [1, 2]; const b = [3, 4]; const result = [...a, ...b]; 👉 Very common in real apps 3. Update Objects (Immutability – VERY IMPORTANT in React) const user = { name: "Javascript" }; const updatedUser = { ...user, age: 21 }; 👉 Don’t mutate original object 4. Pass Array as Function Arguments const nums = [5, 10, 2]; Math.max(...nums); 5. Clone Objects const newUser = { ...user }; 👉 Used in state updates (React) 🔹 Rest Operator (...) → “Collect Values” 1. Functions with Unlimited Arguments function sum(...numbers) { return numbers.reduce((a, b) => a + b); } 👉 Flexible functions 2. Separate Values from Array const [first, ...rest] = [1, 2, 3, 4]; 👉 Extract first → collect remaining 3. Remove Properties from Object const user = { name: "Javascript", age: 21, city: "Hyd" }; const { name, ...others } = user; 👉 Useful for filtering data 4. Handling API Data const { id, ...userData } = response; 👉 Separate important fields >>>Spread = “Break it apart” >>> Rest = “Bring it together” “Both use ... , how do you differentiate?” It depends on context — >> If it’s expanding values → Spread >> If it’s collecting values → Rest Example: function demo(a, b, ...rest) { console.log(a, b, rest); } const arr = [1, 2, 3, 4]; demo(...arr); #JavaScript #WebDevelopment #Frontend #ReactJS #Coding #Developers #LearnJavaScript #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 9/100 – #100DaysOfCode JavaScript & API Fundamentals Review Today I reviewed many core JavaScript concepts that are essential for modern web development. These topics help write cleaner code, handle APIs efficiently, and avoid common bugs. Here are the key areas I covered: 🔹 Variable Declarations Understanding the difference between var, let, and const and why let and const are preferred in modern JavaScript. 🔹 Functions & Syntax Improvements • Default Parameters • Template Strings • Arrow Functions These features make code shorter, cleaner, and easier to maintain. 🔹 Modern JavaScript Features • Spread Operator (...) • Object & Array Destructuring • Optional Chaining These tools make working with complex data much easier. 🔹 Working with Objects Explored utilities like Object.keys(), Object.values(), and Object.entries() for analyzing and looping through object data. 🔹 Core JavaScript Concepts Reviewed important fundamentals such as: • Scope (Global, Block, Function) • Hoisting • Closure • Callback Functions Understanding these deeply helps write more predictable and efficient code. 🔹 Data Types & Comparisons • Primitive vs Non-Primitive • null vs undefined • == vs === • Truthy & Falsy values These are common interview topics and critical for avoiding hidden bugs. 🔹 Array Power Methods Practiced using: map(), filter(), find(), reduce(), and forEach() These methods are the backbone of real-world data manipulation. 🔹 API Fundamentals Learned how client applications communicate with servers using APIs. Key concepts reviewed: • JSON (JSON.parse, JSON.stringify) • Fetch API • HTTP Methods (GET, POST, PATCH, DELETE) • Debugging API requests using the Network Tab and Status Codes 🔹 Async JavaScript Practiced using async/await to handle asynchronous operations in a cleaner and more readable way. Every day of this journey strengthens my understanding of JavaScript and modern web development. Looking forward to applying these concepts in real projects!! #100DaysOfCode #JavaScript #WebDevelopment #Frontend #APIs #AsyncJavaScript #MERN #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 map(), filter(), reduce() in JavaScript (with Definitions + Examples) (Part:3) These 3 array methods are must-know if you want to get strong in JavaScript Example array: let arr = [1, 2, 3, 4, 5]; 1️⃣ map() → Transform data Definition: map() creates a new array by applying a function to each element. let result = arr.map((num) => num * 2); console.log(result); // [2, 4, 6, 8, 10] ✔️ Use when you want to modify every element 2️⃣ filter() → Select data Definition: filter() creates a new array with elements that satisfy a condition. let result = arr.filter((num) => num > 2); console.log(result); //[3, 4, 5] ✔️ Use when you want to pick specific values 3️⃣ reduce() → Combine data Definition: reduce() reduces the array to a single value by applying a function. let result = arr.reduce((acc, num) => acc + num, 0); console.log(result); // 15 ✔️ Use for sum, totals, complex calculations Key Differences: >> map → transforms each element >> filter → selects elements >> reduce → combines into one value 🎯 Important Note: >>> These methods do not change the original array (they return a new one) # forEach() vs map() : 1️⃣ forEach() >> Executes a function for each element >> Does NOT return anything let result = arr.forEach((num) => { return num * 2; }); console.log(result); // undefined 2️⃣ map() >> Transforms each element >> Returns a NEW array let result = arr.map((num) => num * 2); console.log(result); // [2, 4, 6] #JavaScript #Frontend #WebDevelopment #Coding #LearnInPublic
To view or add a comment, sign in
-
🚀 Day 3 / 100 — #100DaysOfCode Most people want to jump straight into frameworks. Today I did the opposite. I went back to the JavaScript fundamentals — because strong foundations compound faster than shiny tools. Here’s what I revised today 👇 🧠 Operators The building blocks of logic in JavaScript. From arithmetic (+ - * /) to comparison (===, !==) and logical operators (&&, ||). They help control how values interact and how conditions are evaluated. 🔁 Loops Automation for repetitive tasks. Revisited for, while, and for...of loops — essential when iterating over arrays, running repeated logic, or processing data collections. ⚙️ Functions Reusable blocks of logic. Functions allow us to write clean, modular code and avoid repetition. Also revisited arrow functions, which make syntax more concise. 📦 Array Methods Some of the most powerful tools in JavaScript. Refreshed methods like: • map() → transform data • filter() → extract specific items • reduce() → combine values into one result These are core to writing clean functional-style JavaScript. 🔒 var vs let vs const Understanding scope is critical. • var → function scoped, older JS • let → block scoped, mutable • const → block scoped, immutable reference Modern JS prefers let and const for predictable behavior. 🧩 Closures One of JavaScript’s most powerful concepts. A closure allows a function to remember variables from its outer scope even after the outer function has finished executing. This is used in callbacks, state management, and many JS patterns. ⏳ Promises & Async/Await JavaScript is asynchronous by nature. • Promises represent a value that will be available in the future • async/await makes asynchronous code look synchronous and much easier to read This is the backbone of API calls, database queries, and modern web apps. ✨ Lesson from today: Frameworks change every year. But JavaScript fundamentals stay forever. Small daily improvements → Big long-term growth. Day 3/100 complete. #JavaScript #WebDevelopment #100DaysOfCode #BuildInPublic #CodingJourney #Developers #LearnInPublic
To view or add a comment, sign in
-
-
⭕ Mastering JavaScript Array Methods with Practical Examples Understanding array methods like map(), filter(), reduce(), and find() is essential for writing clean and efficient JavaScript code. 🔹 1. map() – Transform Data const prices = [100, 200, 300]; const updatedPrices = prices.map(price => price + 50); console.log(updatedPrices); // [150, 250, 350] Used to transform each element and return a new array. ➖ ➖➖➖➖➖➖➖➖➖➖➖➖➖ 🔹 2. filter() – Select Data const numbers = [1, 2, 3, 4, 5, 6]; const evenNumbers = numbers.filter(num => num % 2 === 0); console.log(evenNumbers); // [2, 4, 6] Used to return elements that match a condition. ➖ ➖➖➖➖➖➖➖➖➖➖➖➖➖ 🔹 3. reduce() – Accumulate Data const cart = [500, 1000, 1500]; const totalAmount = cart.reduce((total, item) => total + item, 0); console.log(totalAmount); // 3000 Used for totals, sums, and complex calculations. ➖➖➖➖➖➖➖➖➖➖➖➖➖ 🔹 4. find() – Find First Match const users = [ { id: 1, name: "Rahul" }, { id: 2, name: "Aman" } ]; const user = users.find(userObj => userObj.id === 2); console.log(user); // { id: 2, name: "Aman" } Used to retrieve a specific item based on a condition. ✨ Strong fundamentals in JavaScript improve React components, backend logic in Node.js, and overall project performance. Continuous learning + practical implementation = Better development skills. #JavaScript #MERN #WebDevelopment #FrontendDevelopment #NodeJS #Coding #Developers
To view or add a comment, sign in
Explore related topics
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
Understanding the data flow from Server → JSON String → Parse → JavaScript Object → UI is crucial for building robust frontend applications.