Factorial using recursion in Java

What is Factorial? The factorial of a number n (denoted as n!) is the product of all positive integers up to n. n!=n×(n−1)×(n−2)×⋯×1n! = n \times (n-1) \times (n-2) \times \dots \times 1 Examples: 5!=5×4×3×2×1=1205! = 5 \times 4 \times 3 \times 2 \times 1 = 120 0!=10! = 1 (by definition) Recursive Idea…

0 Comments

Sum of Digits in recursion

The "Sum of Digits in recursion" in Java refers to solving the problem of finding the sum of digits of a number using a recursive method. For example, if the number is 1234, the sum of digits is: 1+2+3+4=101 + 2 + 3 + 4 = 10 How recursion works here: Base case: If…

0 Comments

npm vs pnpm vs npx vs yarn

1. npm (Node Package Manager) Comes by default when you install Node.js. Used to install packages, manage versions, and run scripts. 🔹 Example: Install React npm install react npm install react 🔹 Install globally: npm install -g typescript npm install -g typescript 🔹 Run project scripts (from package.json): npm run build npm run build…

0 Comments

Playwright

Playwright is an open-source end-to-end testing and browser automation framework developed by Microsoft. It allows you to automate actions in web browsers like Chromium (Chrome, Edge), WebKit (Safari), and Firefox with a single API. It’s commonly used for: UI Testing – verifying that web applications work as expected. Web Scraping – extracting data from…

0 Comments

Cypress

Cypress is a modern end-to-end (E2E) testing framework for web applications. It’s mainly used to test how your app behaves in a real browser (Chrome, Edge, Firefox, etc.), simulating actual user interactions such as clicking buttons, filling forms, navigating pages, and making assertions about what should appear on the screen. Unlike older tools like…

0 Comments

What is the DOM

🌐 What is the DOM? The DOM is a programming interface for web documents. It represents the HTML or XML document as a tree structure. Each element (like <div>, <p>, <h1>, etc.) becomes a node in this tree. Example: <html> <body> <h1>Hello</h1> <p>World</p> </body> </html> <html> <body> <h1>Hello</h1> <p>World</p> </body> </html> DOM Tree Representation:…

0 Comments

Local Storage, Session Storage, and Cookies in JavaScript

1. Local Storage Purpose: Stores data in the browser that persists even after the browser is closed. Lifespan: Permanent until explicitly cleared by the user or program. Storage Limit: Usually 5-10 MB per domain. Accessibility: Only accessible on the client-side (browser), not sent with HTTP requests. Example: // Store data localStorage.setItem('username', 'Alice'); // Retrieve…

0 Comments

Error handling in JavaScript using try/catch

1. The Basics of try/catch try/catch lets you handle errors gracefully instead of letting your program crash. Syntax: try { // Code that might throw an error } catch (error) { // Code to handle the error } finally { // Optional: code that runs regardless of error } try { // Code that…

0 Comments

Working with APIs using fetch()

1. What is fetch()? fetch() is a modern JavaScript function that allows you to make network requests (like GET, POST, etc.) to APIs. It returns a Promise, which resolves to the Response object. 2. Basic fetch() Example Suppose we want to get some data from a public API: JSONPlaceholder (fake API for testing). //…

0 Comments

Aggregations and filters in MongoDB

1. Filters in MongoDB Filters are used in queries to select documents that match certain conditions. You generally use find() for this. Example: Suppose we have a collection employees: [ { "_id": 1, "name": "Alice", "age": 30, "department": "HR", "salary": 5000 }, { "_id": 2, "name": "Bob", "age": 25, "department": "IT", "salary": 6000 },…

0 Comments

End of content

No more pages to load