Optional Chaining (?.)

🧩 1. What Is Optional Chaining? Optional chaining (?.) lets you safely access nested object propertieswithout causing an error if something in the chain is null or undefined. 👉 It returns undefined instead of throwing an error. 🧱 The Problem (Without Optional Chaining) const user = {}; console.log(user.profile.name); // ❌ TypeError: Cannot read properties…

0 Comments

Spread (…) and Rest (…)

Let’s go step-by-step through the Spread (...) and Rest (...) operators in modern JavaScript. 👇 🧠 What They Are Both use the same ... syntax — but their behavior depends on where you use them: OperatorActionContextSpread (...)Expands elementsUsed when passing, copying, or mergingRest (...)Collects elementsUsed when receiving or destructuring 🔹 1. The Spread Operator…

0 Comments

Vue Instance

In Vue 3, this concept is expressed using the createApp() function — it’s how you initialize and mount your application. 🧩 What is the Vue Instance (App)? A Vue instance (or app) is the root of your Vue project.It’s the object that: Holds your app’s data, methods, and components. Controls what gets rendered to…

0 Comments

import/export modules

🧩 1. What Are Modules? Modules allow you to split code into separate files and reuse functionality. Each file is a module. Modules can export values (variables, functions, classes) and import them in other files. Benefits: Better code organization Avoid global scope pollution Reusable and maintainable code 🟢 2. Exporting 🔹 Named Exports You…

0 Comments

var, let, and const in JavaScript

🧩 1. var Old way to declare variables (ES5 and earlier). Function-scoped: Available throughout the function where it’s declared. Hoisting: var declarations are hoisted to the top of their scope and initialized as undefined. Can be redeclared and reassigned. 🔹 Example function exampleVar() { console.log(a); // undefined (hoisted) var a = 10; console.log(a); //…

0 Comments

Event Listener

🧩 1. What is an Event Listener? An event listener is a function that waits for a specific event to happen on a DOM element and executes a callback when it occurs. Common events include: click → mouse click input / change → form fields keydown / keyup → keyboard submit → form submission…

0 Comments

Change Content

🧠 1. The Three Main Ways to Change Content Once you’ve selected an element, you can change its content using: PropertyPurposeExample OutputtextContentChange or read only text“Hello World”innerHTMLChange or read HTML inside<b>Hello</b>innerTextChange text but respects CSS visibility“Visible text only” 1️⃣ textContent Use when you just want to set or get plain text — not HTML.…

0 Comments

async/await

1. What is async/await? async/await is a modern way to handle asynchronous code in JavaScript. It’s built on Promises but makes code look synchronous, easier to read, and easier to maintain. async function: Declares a function as asynchronous. It always returns a Promise. await: Pauses the execution of an async function until the Promise…

0 Comments

Promise

1. What is a Promise? A Promise is an object that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. States of a Promise: Pending – initial state, operation not finished yet. Fulfilled (Resolved) – operation finished successfully. Rejected – operation failed. Think of a Promise as a “promise…

0 Comments

ID Token in OpenID Connect

🔐 ID Token in OpenID Connect (OIDC) Definition:An ID Token is a JSON Web Token (JWT) issued by an Identity Provider (IdP) that proves the identity of a user to a client application. While OAuth 2.0 is primarily about authorization (access to resources), the ID Token is about authentication — confirming who the user…

0 Comments

End of content

No more pages to load