<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ramesh Raveendran on Medium]]></title>
        <description><![CDATA[Stories by Ramesh Raveendran on Medium]]></description>
        <link>https://medium.com/@rameshraveendranm?source=rss-0e06e651186b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*WCh1xd0m-xqCxZeL</url>
            <title>Stories by Ramesh Raveendran on Medium</title>
            <link>https://medium.com/@rameshraveendranm?source=rss-0e06e651186b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 23:57:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rameshraveendranm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Zod Explained: Why Modern JavaScript and TypeScript Developers Need It]]></title>
            <link>https://medium.com/@rameshraveendranm/zod-explained-why-modern-javascript-and-typescript-developers-need-it-c85f5ab63991?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c85f5ab63991</guid>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 09:06:31 GMT</pubDate>
            <atom:updated>2026-10-20T09:06:31.481Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered what happens when your application receives the wrong data?</p><p>Imagine building a registration form. You expect a user’s age to be a number, but someone sends &quot;twenty&quot; instead of 20.</p><p>Your application expects one thing but receives something completely different. This can cause errors if the data is used without checking it.</p><p>This is one of the problems <strong>Zod</strong> helps solve.</p><h3>What is Zod?</h3><p>Zod is a data validation library for JavaScript and TypeScript.</p><p>In simple words, <strong>Zod checks whether the data your application receives follows the rules you have defined.</strong></p><p>For example:</p><pre>import { z } from &quot;zod&quot;;</pre><pre>const userSchema = z.object({<br>  name: z.string(),<br>  age: z.number(),<br>});</pre><p>Here, we tell Zod that a user must have a name as a string and an age as a number.</p><p>If the application receives the wrong data, Zod can detect the problem before we use that data in our application logic.</p><p>Think of Zod as a security checkpoint for your data. Before the data moves forward, it gets checked against your rules.</p><h3>But why do we need Zod when TypeScript already exists?</h3><p>This is where things become interesting.</p><p>TypeScript helps developers catch mistakes while writing code. But it cannot automatically guarantee that data coming from an API, a form, or an external service is valid.</p><p>For example, you might define this TypeScript type:</p><pre>type User = {<br>  name: string;<br>  age: number;<br>};</pre><p>Your code expects age to be a number. But if an API sends &quot;twenty&quot;, that incoming data does not magically become valid just because you created a TypeScript type.</p><p><strong>TypeScript checks your code. Zod checks the actual data at runtime.</strong></p><p>That difference is the main reason developers use them together.</p><h3>The best part: Zod and TypeScript work together</h3><p>One of Zod’s most useful features is that it can generate a TypeScript type from a validation schema.</p><pre>const userSchema = z.object({<br>  name: z.string(),<br>  age: z.number(),<br>});</pre><pre>type User = z.infer&lt;typeof userSchema&gt;;</pre><p>Instead of writing the same structure separately for validation and TypeScript, we define the schema once and infer the type from it.</p><p>This reduces duplication and helps keep our validation rules and types consistent.</p><p>It is a small feature, but it makes a real difference when building larger applications.</p><h3>Where do developers use Zod?</h3><p>Zod is useful in many places:</p><ul><li><strong>Backend:</strong> Checking incoming requests before processing them.</li><li><strong>Frontend:</strong> Validating form inputs before submitting them.</li><li><strong>Environment variables:</strong> Checking whether required configuration values are present and correctly formatted.</li><li><strong>External APIs:</strong> Checking received data before relying on it.</li><li><strong>Database operations:</strong> Validating data before inserting or updating records.</li></ul><p>For example, in a Node.js and Express application, Zod can check a registration request before the controller attempts to save a new user.</p><p>It does not save the data itself. It simply helps ensure that the data follows the expected rules.</p><h3>Why has Zod become so popular?</h3><p>Zod is not the only validation library available. So why do so many JavaScript and TypeScript developers use it?</p><p>The biggest reason is its combination of <strong>simple validation, runtime checking, and TypeScript integration</strong>.</p><p>Developers can define rules in a readable way, validate real data, and infer TypeScript types from the same schema. It also supports more complex validation when an application grows.</p><p>Its popularity is reflected in its substantial npm download activity. However, downloads do not represent unique developers, because automated builds and dependency installations also contribute to those numbers.</p><p>You can check its current popularity on the <a href="https://www.npmjs.com/package/zod">Zod npm page</a>.</p><h3>Is Zod worth learning?</h3><p>If you are learning JavaScript, TypeScript, or backend development, Zod is worth understanding.</p><p>You will eventually work with data that comes from users, APIs, or other systems. You cannot always control what those sources send to your application, but you can decide how to validate it.</p><p>That is where Zod becomes valuable.</p><p>You do not need to learn every feature at once. Start with objects, strings, numbers, parse(), and safeParse(). Then explore how Zod fits into an Express application.</p><p>The important thing is to understand the problem it solves, not just memorize its methods.</p><p><strong>In simple terms: TypeScript helps you write safer code, Zod checks your actual data, and together they help you build more reliable applications.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c85f5ab63991" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ECMAScript Type Tags — The Hidden Labels Inside JavaScript]]></title>
            <link>https://medium.com/@rameshraveendranm/ecmascript-type-tags-the-hidden-labels-inside-javascript-22cc71e96e5b?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/22cc71e96e5b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[typetags]]></category>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Thu, 14 May 2026 15:23:03 GMT</pubDate>
            <atom:updated>2026-05-14T15:23:03.812Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FTIrrd89whCa4wzRmS-2cQ.png" /></figure><p>When we write JavaScript code, we usually think only about values like numbers, strings, arrays, or objects. But inside the JavaScript engine, something much deeper is happening. The engine must always understand what kind of value it is working with. Otherwise, it cannot correctly perform operations, store data in memory, or optimize performance. To solve this problem, JavaScript engines use something called Type Tags. A type tag is like a small hidden label attached to every value. This label tells the engine whether the value is a number, string, boolean, object, array, function, or something else. Without these internal labels, the engine would become confused about how to handle data.</p><p>Imagine Ramesh working in a warehouse. Thousands of boxes arrive every day. Some boxes contain food, some contain electronics, and some contain clothes. If none of the boxes had labels, workers would not know how to handle them. Food may need cooling, electronics may need careful handling, and clothes may need folding. So every box gets a sticker label. JavaScript engines work in a similar way. Every value gets an internal “sticker” called a type tag. This is how the engine understands what kind of value it is dealing with.</p><p>For example, when we write:</p><h4><strong><em>let age = 25;<br>let name = “Ramesh”;<br>let online = true;</em></strong></h4><p>the engine internally understands that 25 is a number, “Ramesh” is a string, and true is a boolean. Even though we cannot directly see these hidden labels, the engine depends on them heavily. Internally, the engine may think of values like this:</p><h4>[number] 25<br>[string] “Ramesh”<br>[boolean] true</h4><p>This hidden type information helps JavaScript work correctly and efficiently.</p><p>One interesting thing about JavaScript is that some values can behave unexpectedly because of old design decisions. The most famous example is:</p><p>typeof null</p><p>This returns:</p><p>“object”</p><p>At first, this looks wrong because null is not really an object. This happened because of a historical bug in early JavaScript engines. In the old implementation, objects had a specific binary type tag, and null accidentally used the same tag. Because of this mistake, the engine identified null as an object. Even today, JavaScript keeps this behavior for compatibility reasons. This small mistake became one of the most famous bugs in programming history.</p><p>Arrays also create confusion for beginners. When we run:</p><p>typeof []</p><p>JavaScript returns:</p><p>“object”</p><p>This happens because arrays are technically special kinds of objects. They have extra behaviors like indexed storage and a length property, but internally they still belong to the object family. The correct way to check arrays is:</p><p>Array.isArray([])</p><p>Functions are another special case. If we check:</p><p>typeof function(){}</p><p>the result becomes:</p><p>“function”</p><p>Even though functions are actually objects internally, JavaScript gives them a special type result because functions can be called and executed.</p><p>Inside the engine, the process works step by step. Suppose we write:</p><p>let value = 42;</p><p>First, the engine sees the raw value 42. Then it attaches a number type tag internally. After that, it stores both the type information and the actual value in memory. Later, when we use:</p><p>typeof value</p><p>the engine checks the hidden type tag and returns “number”.</p><p>If we try to build a tiny simplified JavaScript engine ourselves, we might represent values like this:</p><p>{<br> type: “number”,<br> value: 42<br>}</p><p>or:</p><p>{<br> type: “string”,<br> value: “hello”<br>}</p><p>This is basically the simplified idea behind type tagging. Real JavaScript engines are much more advanced, but the core concept is similar.</p><p>Type tags are extremely important for performance. Modern JavaScript engines like V8, SpiderMonkey, and JavaScriptCore use complex internal optimizations based on type information. For example, if the engine knows two values are definitely numbers, addition becomes very fast. But if one value could be a string, then the engine must perform extra checks and possible type conversions. This is one reason why understanding types matters even for performance.</p><p>Type tags are also connected to many advanced JavaScript concepts. They relate to typeof, primitive types, reference types, memory management, garbage collection, hidden classes, and JIT compilation. When developers start learning JavaScript deeply, they slowly realize that many strange JavaScript behaviors become easier to understand once they know about internal type handling.</p><p>The most important thing to remember is that JavaScript values are not just raw data. Every value carries hidden internal information that helps the engine understand and process it. Type tags are one of the core hidden systems that make JavaScript possible. Even though developers usually do not see them directly, they are working silently behind every line of code we write.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22cc71e96e5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHY `n === n1` IS TRUE (AND IT’S NOT ABOUT MEMORY)]]></title>
            <link>https://medium.com/@rameshraveendranm/why-n-n1-is-true-and-its-not-about-memory-d7a406a689df?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7a406a689df</guid>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Fri, 20 Mar 2026 16:25:28 GMT</pubDate>
            <atom:updated>2026-03-20T16:25:28.680Z</atom:updated>
            <content:encoded><![CDATA[<p>PREREQUISITES <br>To understand this topic clearly, you should already know: variables (let, const), primitive data types (number, string, boolean), basic idea of binary (0s and 1s), equality operator (`===`), and a simple idea of memory (not deep internals).</p><p>WHAT <br>In JavaScript, primitive values like numbers are compared by value, not by memory location. This means when you write `let n = 1; let n1 = 1;`, JavaScript does not check whether both variables point to the same binary in memory. Instead, it checks whether both variables hold the same value. So when you write `n === n1`, JavaScript evaluates it as `1 === 1`, and since both values are equal, the result is true. For example, Ramesh is building a mobile app and stores two prices: `let price1 = 100; let price2 = 100;`. When he checks `price1 === price2`, JavaScript simply compares the values and returns true. It does not care about where these values are stored in memory.</p><p>WHY <br>This behavior exists because primitive values are immutable and simple. If JavaScript had to compare memory addresses for every number or string, it would make the language slower and more complex. Instead, it uses a value-based comparison, which is fast and predictable. Even though internally JavaScript engines may optimize memory by storing a single copy of common values like `1`, this is not guaranteed and not used in equality checks. The equality operator `===` is designed to compare values, not storage.</p><p>WHEN <br>This value-based comparison happens whenever you compare primitive values using `===`. For example, `let a = 10; let b = 10;` → `a === b` returns true because `10 === 10`. Similarly, for strings, `let x = “hi”; let y = “hi”;` → `x === y` returns true. The comparison is always based on value, not memory. This is different from objects, where `let obj1 = {x:1}; let obj2 = {x:1};` results in `obj1 === obj2` being false because objects are compared by reference.</p><p>HOW <br>Internally, JavaScript behaves like this: take the value of `n`, take the value of `n1`, compare both values, and return true if they are equal. A simplified pseudocode idea is: get value of n → get value of n1 → compare values → return result. Example code: `let n = 1; let n1 = 1; console.log(n === n1);` which outputs true because both values are equal. In contrast, with objects: `let a = {x:1}; let b = {x:1}; console.log(a === b);` outputs false because JavaScript compares memory references for objects.</p><p>ADVANTAGES <br>Value comparison makes JavaScript simple and predictable for primitives. It improves performance because comparing values is faster than comparing memory structures. Developers do not need to worry about memory details when working with numbers, strings, or booleans.</p><p>DISADVANTAGES <br>This can create confusion when developers start thinking about memory and assume equality means shared storage. The difference between primitive comparison and object comparison can be tricky for beginners.</p><p>Q&amp;A <br>Q1: Does `===` check memory for numbers? A: No, it checks values. <br>Q2: Is `1 === 1` comparing binary internally? A: At a low level yes, but conceptually it is value comparison. <br>Q3: When does JavaScript compare memory? A: For objects, arrays, and functions. <br>Q4: Are two identical objects equal? A: No, unless they reference the same object. <br>Q5: Why is `n === n1` true? A: Because both hold the same value, not because they share memory.</p><p>PRACTICE PROBLEMS <br>1) `let a = 5; let b = 5; console.log(a === b);` → Answer: true <br>2) `let a = “hi”; let b = “hi”; console.log(a === b);` → Answer: true <br>3) `let a = {}; let b = {}; console.log(a === b);` → Answer: false <br>4) `let a = 10; let b = a; b = 20; console.log(a);` → Answer: 10 <br>5) `let a = []; let b = a; console.log(a === b);` → Answer: true</p><p>FINAL IDEA <br>Primitive comparison in JavaScript is always based on value, not memory. Even if engines internally share binary representations, JavaScript does not use that for equality. So `n === n1` being true means both values are equal, not that both variables point to the same memory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7a406a689df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Access Token & Refresh Token (Simple Guide for Developers)]]></title>
            <link>https://medium.com/@rameshraveendranm/understanding-access-token-refresh-token-simple-guide-for-developers-67e26a86f5a1?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/67e26a86f5a1</guid>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 09:35:09 GMT</pubDate>
            <atom:updated>2026-03-16T09:35:09.600Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern applications rarely use a single authentication token anymore. Instead most secure systems use Access Tokens and Refresh Tokens together. This design improves security while keeping the user experience smooth. In this article we will understand what they are, why they exist, and how they work using a simple example.</p><p><strong>1. What are Access Token and Refresh Token?<br></strong><em>Access Token → Short-lived token used to access protected APIs.</em><br><em>Refresh Token → Long-lived token used to generate new access tokens.</em><br>Main idea: The access token lets you access resources while the refresh token helps you obtain a new access token when the old one expires.</p><p>2. Real World Example<br>Imagine we are building a task management application. When a user logs in the server generates two tokens: Access Token valid for 15 minutes and Refresh Token valid for 7 days.</p><p>Flow: Login → Access Token + Refresh Token created → User calls API using Access Token → Access Token expires → Client sends Refresh Token → Server generates new Access Token. The user does not need to log in again.</p><p>3. Why do we need Access + Refresh Tokens?<br>Using only one JWT token can create security issues. Example: a JWT valid for 7 days. If that token is stolen the attacker gets access for the full 7 days. Tokens are also harder to revoke. The solution is using two tokens: Access Token with a short lifetime and Refresh Token with a longer lifetime. Example configuration: <strong><em>Access Token 15 minutes, Refresh Token 7 days</em></strong>. If the access token is stolen the attacker only has a small time window.</p><h4>4. <strong>Authentication Flow</strong><br>1 User logs in<br>2 Server verifies credentials<br>3 Server generates Access Token<br>4 Server generates Refresh Token<br>5 Client stores tokens<br>6 Client sends Access Token in API requests<br>7 Server validates Access Token<br>8 If Access Token expires<br>9 Client sends Refresh Token<br>10 Server issues a new Access Token</h4><p>5. Token Roles<br>Access Token → Used to access protected APIs.</p><p>Example payload: { “id”:”userId”, “role”:”user” }. Typical expiration 10–15 minutes.<br>Refresh Token → Used to generate new Access Tokens. Typical expiration 7–30 days. Usually stored in HTTP-only cookies or in a database.</p><p>6. Example API Flow<br>Login request → POST /login with body { “email”:”<a href="/service/mailto:ramesh@gmail.com">ramesh@gmail.com</a>”, “password”:”123456&quot; }.<br>Server response → { accessToken:”xxxxx”, refreshToken:”yyyyy” }.<br>Access protected API → GET /tasks with header Authorization: Bearer accessToken.<br>If the access token expires the server returns 401 Unauthorized.<br>Client then sends POST /refresh with body { refreshToken:”yyyy” }.<br>Server responds with a new access token → { accessToken:”newToken” }. The user continues without logging in again.</p><p>7. Simple Implementation Logic<br>Login logic: verify user → create accessToken(userId,15min) → create refreshToken(userId,7days) → store refreshToken in database → return both tokens.<br>Refresh logic: verify refreshToken → if valid generate new accessToken → return accessToken.</p><p>8. Example Node.js Code<br>Access token creation:<br>jwt.sign({ id:user._id }, process.env.ACCESS_SECRET, { expiresIn:”15m” });</p><p>Refresh token creation:<br>jwt.sign({ id:user._id }, process.env.REFRESH_SECRET, { expiresIn:”7d” });</p><p>Refresh endpoint example:<br>router.post(“/refresh”, async (req,res)=&gt;{ const {refreshToken}=req.body; if(!refreshToken){ return res.status(401).json({message:”No refresh token”});} try{ const decoded=jwt.verify(refreshToken,process.env.REFRESH_SECRET); const accessToken=jwt.sign({id:decoded.id},process.env.ACCESS_SECRET,{expiresIn:”15m”}); res.json({accessToken}); }catch(err){ res.status(403).json({message:”Invalid refresh token”}); } });</p><p>9. Advantages<br>Better security because stolen access tokens expire quickly. Better user experience because users do not need to log in repeatedly. This architecture is widely used in modern API systems.</p><p>10. Disadvantages<br>The architecture is more complex. Developers must manage refresh token storage, token rotation, and token revocation.</p><p>11. Common Questions<br>Why not use only one JWT? Because long-lived tokens are less secure.<br>Why are access tokens short-lived? To limit damage if they are stolen.<br>Where should refresh tokens be stored? Usually HTTP-only cookies or a database.<br>Do refresh tokens expire? Yes, typically after 7–30 days.<br>Can refresh tokens be revoked? Yes, by deleting them from the database.</p><p>Final Thoughts<br>Using Access Tokens and Refresh Tokens together is now a standard authentication design for modern APIs. It provides better security, smoother user experience, and scalable architecture. If you are building modern APIs understanding this pattern is essential for production-grade authentication systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67e26a86f5a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHY OBJECTS ARE PASSED BY REFERENCE (js)]]></title>
            <link>https://medium.com/@rameshraveendranm/why-objects-are-passed-by-reference-js-b098d558302b?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b098d558302b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jsbasic]]></category>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[pass-by-reference]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 16:25:10 GMT</pubDate>
            <atom:updated>2026-03-16T09:21:30.166Z</atom:updated>
            <content:encoded><![CDATA[<p>WHY OBJECTS ARE PASSED BY REFERENCE</p><p>PREREQUISITES<br>To understand this topic clearly, you should already know: <strong><em>variables, primitive data types (number, string, boolean, null, undefined), objects in JavaScript, basic memory idea (stack vs heap), function parameters, and how assignment works in JavaScript</em></strong>.</p><p>WHAT<br>In JavaScript, <strong><em>Objects are passed by value,but the value is a reference to the object</em></strong>. This means a variable does not store the actual object itself; it stores a reference (memory address) that points to where the object is stored in memory. When an object is assigned to another variable or passed to a function, JavaScript copies the reference instead of copying the entire object. Because of this, multiple variables can point to the same object in memory. For example, Ramesh is building a mobile app that manages user profiles. He creates an object like `let user = { name: “Ramesh”, age: 25 }`. If he writes `let admin = user`, both `user` and `admin` now point to the same object. When `admin.age = 30`, the original object changes, so `user.age` also becomes 30. This behavior exists because objects can be large structures containing many nested properties like profile, settings, posts, and comments. Copying the entire object every time would consume more memory and reduce performance. Instead, JavaScript simply copies the reference (like a pointer), making programs faster and more memory-efficient.</p><p>WHEN<br>This reference behavior appears mainly in three situations: variable assignment, passing objects to functions, and returning objects from functions. For example, `let obj1 = { name: “Ramesh” }; let obj2 = obj1;` makes both variables point to the same object. When passing to functions, the same reference is used: `function updateUser(user){ user.age = 30 } updateUser(obj1);` modifies the original object. When a function returns an object, like `function createUser(){ return { name: “Ramesh” } }`, the returned value is also a reference to the object stored in memory.</p><p>HOW<br>Internally, JavaScript uses two main memory areas: stack and heap. The stack stores variables and primitive values, while objects are stored in the heap. When we create an object like `let user = { name: “Ramesh” }`, the actual object is stored in heap memory, and the variable `user` stores the address of that object. If another variable is assigned, `let admin = user`, JavaScript copies the address only, not the object itself. A simplified pseudocode idea is: create object in heap → store its address in variable → when assigning to another variable, copy only the address → both variables now point to the same object. Example code: `let user = { name: “Ramesh”, age: 25 }; function updateUser(u){ u.age = 30 } updateUser(user); console.log(user.age);` which outputs 30 because both references point to the same object.</p><h4><strong>ADVANTAGES</strong><br>Passing objects by reference has several advantages. It is memory efficient because the program does not need to duplicate large objects. It improves performance because copying references is faster than copying large data structures. It also allows easy data sharing across different parts of an application. For example, the same user object can be passed to authentication services, database services, and logging systems without creating multiple copies.</h4><h4><strong>DISADVANTAGES</strong><br>However, this behavior can also cause problems. One disadvantage is side effects, where modifying an object in one part of the program unexpectedly changes it in another part. This can introduce bugs if developers assume they are working with separate copies. Debugging can also become harder when many parts of the program share the same reference. Beginners often make the mistake of thinking `let newUser = user` creates a new object, but it only copies the reference.</h4><p>Q&amp;A<br>Q1: Are objects passed by value or reference in JavaScript? A: Objects are passed by reference (technically reference value). <br>Q2: What does an object variable store? A: The memory address of the object. <br>Q3: What happens when we write `let b = a` where a is an object? A: The reference is copied, so both variables point to the same object. <br>Q4: How can we create a copy instead of sharing the same reference? A: Use spread operator, Object.assign(), or structuredClone(). <br>Q5: Why does changing one variable affect another? A: Because both variables reference the same object in memory.</p><p>PRACTICE PROBLEMS<br>1) Predict output: `let a = {x:1}; let b = a; b.x = 10; console.log(a.x);` → Answer: 10 <br>2) `let user = {name:”Ramesh”}; function change(u){ u.name=”Arun” } change(user); console.log(user.name);` → Answer: Arun <br>3) `let a = {x:1}; let b = {…a}; b.x = 5; console.log(a.x);` → Answer: 1 because spread creates a copy. <br>4) `let a={x:1}; let b=a; let c=b; c.x=20; console.log(a.x);` → Answer: 20 because all variables reference the same object.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b098d558302b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ObjectID in MongoDB (_id)]]></title>
            <link>https://medium.com/@rameshraveendranm/objectid-in-mongodb-id-9fb0763b332a?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fb0763b332a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mongodb-tutorial]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Fri, 17 Oct 2025 16:18:27 GMT</pubDate>
            <atom:updated>2025-10-17T16:18:27.942Z</atom:updated>
            <content:encoded><![CDATA[<p>In MongoDB, every document must have a unique _id field that acts like a primary key. If you don’t specify it, MongoDB automatically generates it using a special data type called <strong>ObjectId</strong>. For example:</p><p>{<br> “_id”: ObjectId(“507f1f77bcf86cd799439011”),<br> “name”: “Ramesh”,<br> “age”: 22<br>}</p><p>Here, ObjectId(&quot;507f1f77bcf86cd799439011&quot;) is the unique identifier for this document, allowing MongoDB to identify documents uniquely and quickly search, index, and reference them. An ObjectId is a <strong>12-byte identifier</strong>, typically shown as a <strong>24-character hexadecimal string</strong>, internally divided into three parts — <strong>4 bytes</strong> for the timestamp (the creation time of the ObjectId, measured in seconds since the Unix epoch), <strong>5 bytes</strong> for the machine identifier (a unique ID for the machine or process that generated it), and <strong>3 bytes</strong> for the counter (a random incrementing value to avoid duplicates). This structure ensures every ObjectId is globally unique and time-ordered, meaning newer documents always have larger ObjectIds. Interestingly, you can even extract the creation time of a document directly from its ObjectId using the command ObjectId(&quot;507f1f77bcf86cd799439011&quot;).getTimestamp(), which outputs a readable timestamp like 2012-10-17T20:46:15Z. This powerful design allows MongoDB to automatically handle identity, uniqueness, and chronological sorting without the need for manual primary key management or additional timestamp fields, making data retrieval and indexing both fast and efficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fb0763b332a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Runtime Environment ?]]></title>
            <link>https://medium.com/@rameshraveendranm/what-is-runtime-environment-71917514cd1d?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/71917514cd1d</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[runtime-environment]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[browsers]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 07:42:32 GMT</pubDate>
            <atom:updated>2025-07-27T07:42:32.780Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Is Runtime Environment ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3i4_SCOpG7fDx8wOlmjYTQ.png" /></figure><p>A <strong>runtime environment</strong> is a background system that allows your code to run. It provides built-in <strong>functions</strong>, <strong>methods</strong>, and <strong>APIs</strong> that help your code interact with the system and perform actions. In JavaScript, there are mainly <strong>two types of runtime environments</strong>: <strong>Browser Runtime</strong> and <strong>Node.js Runtime</strong>.</p><p>The <strong>Browser Runtime</strong> runs JavaScript code <strong>inside the browser</strong> and is mainly used for <strong>frontend</strong> development. It provides access to things like the <strong>DOM (Document Object Model)</strong>, <strong>window object</strong>, and handles user interactions such as <strong>clicks</strong>, <strong>typing</strong>, or page changes. It doesn’t work with files, databases, or the server — it only interacts with the <strong>web interface</strong> (client-side).</p><p>The <strong>Node.js Runtime</strong> runs JavaScript code <strong>outside the browser</strong>, usually on a <strong>server</strong>. It’s used for <strong>backend development</strong> and gives access to <strong>OS-level features</strong> like the file system, network, creating servers, working with databases, and more.</p><p>Even though both runtimes are different, they share some similarities. Both use the <strong>V8 engine</strong> (from Google Chrome) to convert JavaScript into <strong>machine code</strong>. They both use <strong>event loops</strong> to handle asynchronous tasks and support functions like setTimeout, setInterval, and <strong>callback queues</strong> to manage non-blocking operations.</p><p>So, while <strong>Browser Runtime</strong> is for <strong>frontend (client-side)</strong> interactions and <strong>Node Runtime</strong> is for <strong>backend (server-side)</strong> logic, they both work on the same core JavaScript engine and follow similar processing models.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71917514cd1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Array What Was That ?]]></title>
            <link>https://medium.com/@rameshraveendranm/array-what-was-that-36f7f1168896?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/36f7f1168896</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Sat, 05 Jul 2025 08:52:58 GMT</pubDate>
            <atom:updated>2025-07-05T08:53:03.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Array What Was That ?</h3><h4>In other languages like (c,c++,java)</h4><p>Array is a <strong>linear data structure</strong> that is a <strong>collection of data elements</strong> of same types. Arrays are<strong> stored in contiguous memory locations</strong>. It is a static data structure with a fixed size.</p><h4>In JavaScript</h4><p>An <strong>array in JavaScript</strong> is a linear data structure that stores a list of elements. Unlike some languages, JavaScript arrays can store elements of <strong>different types</strong> and have <strong>dynamic sizes</strong>, meaning you can add or remove elements at any time.</p><p><strong><em>linear data structure</em></strong></p><p><em>A linear data structure is a way to organize data where elements are arranged in a sequence, one after the other.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36f7f1168896" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Immediately Invoked Function Expression (IIFE)]]></title>
            <link>https://medium.com/@rameshraveendranm/immediately-invoked-function-expression-iife-4abd48cfa868?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4abd48cfa868</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[iife]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Fri, 04 Jul 2025 07:15:06 GMT</pubDate>
            <atom:updated>2025-07-04T07:15:06.604Z</atom:updated>
            <content:encoded><![CDATA[<p>An <strong>IIFE (Immediately Invoked Function Expression)</strong> is a function in JavaScript that runs immediately after it’s defined. It looks like this: (function() { /* code */ })();. The first () turns the function into an expression, and the second () calls it right away. IIFEs are mainly used to create a private scope and avoid polluting the global scope. This was especially useful before let and const existed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*gNOzdVUlLZf98yGZ4cWHrQ.png" /></figure><h3>🔹 Why Use IIFE?</h3><p><strong>Avoid polluting global scope</strong></p><ul><li>Variables inside IIFE stay <strong>private</strong></li></ul><p><strong>Run code immediately</strong></p><p>Great for quick setup/config</p><p><strong>Create a private scope</strong></p><ul><li>Useful in older JavaScript before let and const</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4abd48cfa868" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rest parameters (…args)]]></title>
            <link>https://medium.com/@rameshraveendranm/rest-parameters-args-975552bb30df?source=rss-0e06e651186b------2</link>
            <guid isPermaLink="false">https://medium.com/p/975552bb30df</guid>
            <category><![CDATA[learning-and-development]]></category>
            <category><![CDATA[rest-parameter]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ramesh Raveendran]]></dc:creator>
            <pubDate>Fri, 04 Jul 2025 05:04:35 GMT</pubDate>
            <atom:updated>2025-07-04T05:04:35.135Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello guys how are you doing today i hope you all good !</p><p>Simple example of Rest parameter………….</p><p>The <strong>rest parameter</strong> in JavaScript is used in functions to collect extra arguments into an array. It is written using three dots (...). For example, in the function function greet(...names), if we call greet(&quot;John&quot;, &quot;Jane&quot;, &quot;Jim&quot;), all the names will be collected into an array called names → [&quot;John&quot;, &quot;Jane&quot;, &quot;Jim&quot;]. This is useful when we don&#39;t know how many arguments will be passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*uFDUUWcxA6oi9NzOzQ7nOQ.png" /></figure><h3>Key Points:</h3><ul><li>Only one <strong>rest parameter</strong> is allowed.</li><li>It <strong>must be the last parameter</strong>.</li><li>It always returns an <strong>array</strong>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=975552bb30df" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>