<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Tanvir Ahmed</title>
    <description>The latest articles on Forem by Tanvir Ahmed (@tanvir_ahamed).</description>
    <link>https://forem.com/tanvir_ahamed</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2197781%2Fd4c461d1-64ef-40be-b165-f40b5334edb7.png</url>
      <title>Forem: Tanvir Ahmed</title>
      <link>https://forem.com/tanvir_ahamed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tanvir_ahamed"/>
    <language>en</language>
    <item>
      <title>JavaScript Nullish Coalescing Operator (??)</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Sat, 01 Nov 2025 05:03:24 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/javascript-nullish-coalescing-operator--7ko</link>
      <guid>https://forem.com/tanvir_ahamed/javascript-nullish-coalescing-operator--7ko</guid>
      <description>&lt;p&gt;Nullish Coalescing Operator (??) হলো JavaScript-এর একটি আধুনিক লজিক্যাল অপারেটর, যা কোনো ভ্যারিয়েবলের মান null বা undefined হলে একটি default (বিকল্প) মান ব্যবহার করতে সাহায্য করে।&lt;/p&gt;

&lt;p&gt;syntax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let result = value1 ?? value2;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ব্যাখ্যা:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;যদি value1 null বা undefined না হয়, তাহলে value1 রিটার্ন করবে।&lt;/li&gt;
&lt;li&gt;যদি value1 null বা undefined হয়, তাহলে value2 রিটার্ন করবে।
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name = null;
let finalName = name ?? "Guest";

console.log(finalName); // Output: "Guest"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;এখানে name এর মান null, তাই ?? অপারেটর "Guest" রিটার্ন করেছে।&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name = "Tanvir";
let finalName = name ?? "Guest";

console.log(finalName); // Output: "Tanvir"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;যেহেতু name-এর মান আছে, তাই fallback "Guest" ব্যবহৃত হয়নি।&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Undefined এর ক্ষেত্রে&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age;
let defaultAge = 18;

let finalAge = age ?? defaultAge;

console.log(finalAge); // Output: 18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;age undefined, তাই defaultAge (১৮) রিটার্ন হয়েছে।&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>career</category>
    </item>
    <item>
      <title>Node.js Stream এবং Buffer</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Wed, 29 Oct 2025 00:02:55 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/nodejs-stream-ebn-buffer-dg0</link>
      <guid>https://forem.com/tanvir_ahamed/nodejs-stream-ebn-buffer-dg0</guid>
      <description>&lt;h4&gt;
  
  
  💻 Node.js: Buffer (বাফার)
&lt;/h4&gt;

&lt;p&gt;Buffer হলো Node.js-এর একটি বিল্ট-ইন ক্লাস যা বাইনারি ডেটা পরিচালনার জন্য ব্যবহৃত হয়। JavaScript সাধারণত স্ট্রিং এবং অবজেক্ট নিয়ে কাজ করে, কিন্তু ফাইল, নেটওয়ার্ক ডেটা বা অন্যান্য বাইনারি ডেটা প্রক্রিয়াকরণের জন্য Buffer ব্যবহার করা হয়। Buffer হলো একটি ফিক্সড-সাইজের মেমরি ব্লক যা বাইনারি ডেটা স্টোর করে।&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Buffer-এর মূল বৈশিষ্ট্য:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;বাইনারি ডেটা সরাসরি ম্যানিপুলেট করার জন্য ব্যবহৃত হয়।&lt;br&gt;
এটি ArrayBuffer-এর মতো কিন্তু আরও ফ্লেক্সিবল এবং Node.js-এর জন্য অপটিমাইজড।&lt;br&gt;
কোনো এনকোডিং ছাড়াই কাঁচা (raw) ডেটা স্টোর করতে পারে।&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const buf = Buffer.from('Hello', 'utf8');

console.log(buf);
// আউটপুট: &amp;lt;Buffer 48 65 6c 6c 6f&amp;gt;

console.log(buf.toString());
// আউটপুট: Hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💻 Node.js: Stream (স্ট্রীম)&lt;/p&gt;

&lt;p&gt;Stream হলো Node.js-এর একটি শক্তিশালী ফিচার যা ডেটাকে ছোট ছোট অংশে (chunks) প্রক্রিয়া করতে দেয়। এটি বড় ফাইল বা নেটওয়ার্ক ডেটা পরিচালনার জন্য উপযোগী, কারণ পুরো ডেটা একসাথে মেমরিতে লোড করার প্রয়োজন হয় না।&lt;/p&gt;

&lt;p&gt;Stream-এর প্রকারভেদ:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Readable Stream: ডেটা পড়ার জন্য (যেমন: ফাইল থেকে পড়া, HTTP রিকোয়েস্ট থেকে ডেটা পড়া)।&lt;/li&gt;
&lt;li&gt;Writable Stream: ডেটা লেখার জন্য (যেমন: ফাইলে লেখা, HTTP রেসপন্সে লেখা)।&lt;/li&gt;
&lt;li&gt;Duplex Stream: পড়া এবং লেখা উভয়ই সম্ভব (যেমন: TCP সকেট)।&lt;/li&gt;
&lt;li&gt;Transform Stream: ডেটা পড়া এবং লেখার সময় মডিফাই করা যায় (যেমন: কম্প্রেশন)।&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stream-এর সুবিধা:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;মেমরি দক্ষতা: বড় ফাইল বা ডেটা প্রক্রিয়াকরণে কম মেমরি ব্যবহার করে।&lt;/li&gt;
&lt;li&gt;দ্রুততা: ডেটা চাঙ্কে প্রক্রিয়া হওয়ায় অপেক্ষার সময় কমে।&lt;/li&gt;
&lt;li&gt;পাইপলাইন: এক স্ট্রিম থেকে আরেক স্ট্রিমে ডেটা পাঠানো সহজ।&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Readable Stream উদাহরণ:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fs = require('fs');

// Readable Stream তৈরি
const readStream = fs.createReadStream('input.txt', { encoding: 'utf8' });

// ডেটা পড়া
readStream.on('data', (chunk) =&amp;gt; {
  console.log('নতুন চাঙ্ক পাওয়া গেছে:');
  console.log(chunk);
});

// স্ট্রিম শেষ হলে
readStream.on('end', () =&amp;gt; {
  console.log('ডেটা পড়া শেষ।');
});

// ত্রুটি হ্যান্ডলিং
readStream.on('error', (err) =&amp;gt; {
  console.error('ত্রুটি:', err);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Writable Stream উদাহরণ:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fs = require('fs');

// Writable Stream তৈরি
const writeStream = fs.createWriteStream('output.txt');

// স্ট্রিমে ডেটা লেখা
writeStream.write('এটি একটি টেস্ট ডেটা।\n', 'utf8');
writeStream.write('আরেকটি লাইন।\n', 'utf8');

// স্ট্রিম বন্ধ করা
writeStream.end();

// লেখা শেষ হলে
writeStream.on('finish', () =&amp;gt; {
  console.log('ডেটা লেখা শেষ।');
});

// ত্রুটি হ্যান্ডলিং
writeStream.on('error', (err) =&amp;gt; {
  console.error('ত্রুটি:', err);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;পাইপিং (Piping) উদাহরণ:&lt;br&gt;
পাইপিং হলো একটি Readable Stream থেকে ডেটা সরাসরি Writable Stream-এ পাঠানোর প্রক্রিয়া।&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fs = require('fs');

const readStream = fs.createReadStream('input.txt');
const writeStream = fs.createWriteStream('output.txt');

// পাইপিং
readStream.pipe(writeStream);

console.log('ডেটা পাইপ করা হয়েছে।');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Transform Stream উদাহরণ:&lt;br&gt;
Transform Stream ডেটাকে মডিফাই করে। নিচে একটি উদাহরণ দেওয়া হলো যেখানে ডেটাকে বড় হাতের অক্ষরে রূপান্তর করা হচ্ছে।&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { Transform } = require('stream');

const upperCaseTransform = new Transform({
  transform(chunk, encoding, callback) {
    this.push(chunk.toString().toUpperCase());
    callback();
  }
});

process.stdin.pipe(upperCaseTransform).pipe(process.stdout);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  💻 উপসংহার
&lt;/h4&gt;

&lt;p&gt;Node.js-এ Buffer এবং Stream হলো শক্তিশালী টুল যা বাইনারি ডেটা এবং বড় ডেটা সেট পরিচালনার জন্য ব্যবহৃত হয়। Buffer ব্যবহার করা হয় ছোট ডেটা ম্যানিপুলেশনের জন্য, আর Stream ব্যবহার করা হয় মেমরি-দক্ষ উপায়ে বড় ডেটা প্রক্রিয়াকরণের জন্য। এগুলো ব্যবহার করে ফাইল সিস্টেম, নেটওয়ার্কিং এবং ডেটা প্রসেসিংয়ে দক্ষতা বাড়ানো যায়।&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why NestJS is the Ideal Framework for Scaling Large JavaScript Projects</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Sun, 22 Jun 2025 06:42:42 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/why-nestjs-is-the-ideal-framework-for-scaling-large-javascript-projects-5cdk</link>
      <guid>https://forem.com/tanvir_ahamed/why-nestjs-is-the-ideal-framework-for-scaling-large-javascript-projects-5cdk</guid>
      <description>&lt;p&gt;A crucial choice in the constantly changing field of JavaScript development is which framework to use for large-scale projects. Let's introduce NestJS, a potent framework that is quickly taking the lead in creating dependable, scalable apps. We'll look at the reasons why NestJS is unique for creating intricate, enterprise-level applications in this post.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is NestJS?
&lt;/h3&gt;

&lt;p&gt;NestJS is an advanced framework for Node.js server-side application development. It is a fantastic choice for large-scale applications because it uses TypeScript and is greatly influenced by Angular. Because it can easily tackle enterprise-level difficulties, it has garnered a lot of popularity since Kamil Myśliwiec launched it in 2017.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features for Scaling Large Projects
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1.Modular Architecture&lt;/strong&gt;&lt;br&gt;
A project can be easily broken up into smaller, reusable, and self-contained components thanks to NestJS's encouragement of modular design. Teams can work separately on different project components without treading on each other's toes thanks to this modular approach, which aids in application scalability. Modules are simple to add, remove, or change as your project develops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.TypeScript Support&lt;/strong&gt;&lt;br&gt;
TypeScript support is built into NestJS by default, allowing your code to use static typing. Particularly when dealing with big teams, this translates into fewer runtime errors and a more stable, maintainable codebase. The interfaces and decorators provided by TypeScript also improve the organization and clarity of code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Dependency Injection&lt;/strong&gt;&lt;br&gt;
The robust dependency injection mechanism in NestJS makes dependency management simple. In order to maintain the scalability and flexibility of your application, this solution helps decouple your services and streamlines testing and maintenance. During tests, it is simpler to simulate dependencies and inject services where necessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.Built-in ORM Support&lt;/strong&gt;&lt;br&gt;
Complex data management is a major concern when developing huge apps. Popular Object-Relational Mapping (ORM) technologies like TypeORM and Sequelize are supported by NestJS, which facilitates seamless database connections. Advanced queries, relationships, and migrations are all built into NestJS and are crucial for effectively managing massive volumes of data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.Middleware and Interceptors&lt;/strong&gt;&lt;br&gt;
In large projects, resolving cross-cutting issues like error management, authentication, and logging can become difficult. This is made easier by NestJS's middleware and interceptors, which enable you to handle these issues in an organized manner. It's easy to handle exceptions, change responses, and manage the complete request-response cycle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.WebSocket and Microservices Support&lt;/strong&gt;&lt;br&gt;
NestJS is ideal for applications requiring distributed systems or real-time communication. WebSockets and microservices architectures are supported by default, making it ideal for applications requiring quick, low-latency communication, such as chat systems or Internet of Things platforms.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits for Large Projects
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improved Maintainability:&lt;/strong&gt;NestJS reduces technical debt by making it simpler to scale and maintain your code over time using its own modular structure and TypeScript's type safety.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced Collaboration:&lt;/strong&gt;NestJS's modular design minimizes code overlap and enhances teamwork by enabling many developers to work on separate modules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance Optimization:&lt;/strong&gt;The non-blocking I/O mechanism of Node.js allows NestJS to guarantee great performance even as the project expands.  The framework's effective architecture can easily manage higher traffic levels.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensibility:&lt;/strong&gt;NestJS's functionality may be expanded without changing the core framework thanks to its support for custom decorators and plugins.  As your project's needs change, you can incorporate additional functionality.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Challenges and Solutions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Learning Curve:&lt;/strong&gt;NestJS has very powerful capabilities, however there is a learning curve.  What's wrong?  To catch up, go through the community lessons and documentation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Overhead:&lt;/strong&gt;It may feel more complicated to set up first than with simpler frameworks.  However, the overhead is decreased by the ability to quickly build boilerplate code with NestJS's CLI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Testing Complexity:&lt;/strong&gt;It might be challenging to do the extensive testing needed for large projects.  For thorough test coverage, you can combine NestJS with Jest, which fortunately has built-in testing facilities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;A notable framework for creating sizable, scalable JavaScript applications is NestJS.  Enterprise-level projects benefit greatly from its modular design, TypeScript integration, and support for strong features like dependency injection, WebSocket connectivity, and microservices.  NestJS provides you with the resources you need to be successful whether you're developing a complex commercial application, real-time system, or website with a lot of traffic.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>TypeScript Data Types - Comprehensive Guide</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Sat, 14 Jun 2025 06:52:10 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/typescript-data-types-comprehensive-guide-57hn</link>
      <guid>https://forem.com/tanvir_ahamed/typescript-data-types-comprehensive-guide-57hn</guid>
      <description>&lt;p&gt;TypeScript provides a robust type system built on top of JavaScript, helping ensure the accuracy of your code's types. In this guide, we will explore both primitive and non-primitive data types in TypeScript, complete with explanations and examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  ❏ Primitive Data Types
&lt;/h2&gt;

&lt;p&gt;Primitive data types are the most basic types in TypeScript, and they represent single values. These types are immutable, meaning their values cannot be changed once set. TypeScript supports the following primitive data types:&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;Any&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The any type is a special type in TypeScript that allows you to store values of any type. It is used when you are unsure about the type of a variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let data: any;
data = "Hello, world!";   // string
data = 42;                // number
data = { key: "value" };  // object
data = [1, 2, 3];         // array
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ &lt;strong&gt;Number&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The number type is used for numerical values, both integers and floating-point numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age: number = 25;
let price: number = 199.99;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3️⃣ &lt;strong&gt;String&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The string type is used to represent text (sequences of characters).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name: string = "John";
let greeting: string = "Hello, world!";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4️⃣ &lt;strong&gt;Boolean&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The boolean type represents true or false values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let isActive: boolean = true;
let isComplete: boolean = false;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5️⃣ &lt;strong&gt;undefined&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The undefined type is used when a variable is declared but not assigned a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let notAssigned: undefined = undefined;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6️⃣ &lt;strong&gt;null&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The null type is used to indicate that a variable has no value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let emptyValue: null = null;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ❏ Non-Primitive Data Types
&lt;/h2&gt;

&lt;p&gt;Non-primitive data types in TypeScript (also called reference types) are used to store collections of values or more complex structures. Unlike primitive types, non-primitive types are mutable (can be changed), and they store references to the values in memory, not the actual values themselves.&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;Array Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An array holds a collection of values of a specific type. TypeScript provides two ways to declare an array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let numbers: number[] = [1, 2, 3, 4, 5];
let fruits: Array&amp;lt;string&amp;gt; = ['apple', 'banana', 'cherry'];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Array with Mixed Types:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let mixedArray: (number | string)[] = [1, 'apple', 2, 'banana'];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ &lt;strong&gt;Object Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An object in TypeScript is a collection of key-value pairs where each key is a string and each value can be of any type.&lt;/p&gt;

&lt;p&gt;emample:01&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
  firstName: "John",
  lastName: "Doe",
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;emample:02&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user2: {
  company: "Programming Here";
  firstName: string;
  middleName?: string;  // Optional property
  lastName: string;
  isMarried: boolean;
} = {
  company: "Programming Here",
  firstName: "Tanvir",
  lastName: "Soysov",
  isMarried: true,
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3️⃣ &lt;strong&gt;Function Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Functions in TypeScript can be typed by defining the types of parameters and return values.&lt;/p&gt;

&lt;p&gt;Function Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function add(a: number, b: number): number {
  return a + b;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ❏ Other Types
&lt;/h2&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;unknown Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The unknown type in TypeScript is a type-safe version of any. When a variable's type is unknown, TypeScript enforces that you cannot perform operations on it until you explicitly check its type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleData = (data: unknown) =&amp;gt; {
    if (typeof data === 'string') {
        console.log("String length:", data.length);
    } else if (typeof data === 'number') {
        console.log("Number squared:", data * data);
    } else {
        console.log("Unknown type");
    }
};
handleData("hello");    // String length: 5
handleData(4);          // Number squared: 16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ &lt;strong&gt;Nullable Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A nullable type in TypeScript means that a variable can either have a value or be null or undefined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const searchName = (value: string | null) =&amp;gt; {
    if (value) {
        console.log("Searching for:", value);
    } else {
        console.log("There is nothing to search.");
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3️⃣ &lt;strong&gt;Never Data Type&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The never type is used when a function never returns a value. This typically happens when a function throws an error or has an infinite loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const throwError = (message: string): never =&amp;gt; {
    throw new Error(message);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;TypeScript's type system enables developers to write safer and more robust code. By understanding and using both primitive and non-primitive data types, as well as special types like any, unknown, nullable, and never, you can harness the full power of TypeScript in your projects.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JavaScript Math Object Demystified</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Sun, 02 Mar 2025 08:18:22 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/javascript-math-object-demystified-nag</link>
      <guid>https://forem.com/tanvir_ahamed/javascript-math-object-demystified-nag</guid>
      <description>&lt;p&gt;The JavaScript Math object is a built-in object that provides mathematical functions and constants for performing complex calculations. It is static, meaning you do not need to create an instance of it to use its methods. Instead, you can directly call its properties and methods using Math.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;❑ Math Constants (Predefined Values)&lt;/strong&gt;&lt;br&gt;
✔️Math.PI       3.141592653589793&lt;br&gt;
✔️Math.E     2.718281828459045    &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding JavaScript Data Types: A Comprehensive Guide to Primitive and Reference Types with Examples</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Tue, 31 Dec 2024 10:19:22 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/understanding-javascript-data-types-a-comprehensive-guide-to-primitive-and-reference-types-with-3f7f</link>
      <guid>https://forem.com/tanvir_ahamed/understanding-javascript-data-types-a-comprehensive-guide-to-primitive-and-reference-types-with-3f7f</guid>
      <description>&lt;p&gt;JavaScript has several built-in data types, which can be categorized into two broad groups: &lt;/p&gt;

&lt;h1&gt;
  
  
  🗹 Primitive Types
&lt;/h1&gt;

&lt;h1&gt;
  
  
  🗹 Non-Primitive (Reference) Types.
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
        &lt;thead&gt;
            &lt;tr&gt;
                &lt;th&gt;Aspect&lt;/th&gt;
                &lt;th&gt;Primitive Data Types&lt;/th&gt;
                &lt;th&gt;Reference Data Types&lt;/th&gt;
            &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
            &lt;tr&gt;
                &lt;td&gt;Examples&lt;/td&gt;
                &lt;td&gt;Number, String, Boolean&lt;/td&gt;
                &lt;td&gt;Object, Array, Function&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Storage&lt;/td&gt;
                &lt;td&gt;Stack&lt;/td&gt;
                &lt;td&gt;Heap&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Mutability&lt;/td&gt;
                &lt;td&gt;Immutable&lt;/td&gt;
                &lt;td&gt;Mutable&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Value Type&lt;/td&gt;
                &lt;td&gt;Stored as value&lt;/td&gt;
                &lt;td&gt;Stored as reference&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Passing in Function&lt;/td&gt;
                &lt;td&gt;Passed by value&lt;/td&gt;
                &lt;td&gt;Passed by reference&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Type Checking&lt;/td&gt;
                &lt;td&gt;typeof&lt;/td&gt;
                &lt;td&gt;typeof, instanceof&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Performance&lt;/td&gt;
                &lt;td&gt;Faster&lt;/td&gt;
                &lt;td&gt;Slower&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/tbody&gt;
    &lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Now,&lt;/p&gt;

&lt;h2&gt;
  
  
  ⌬ Storage
&lt;/h2&gt;

&lt;p&gt;➕ Primitive Data Types: Stored in the stack (fixed memory allocation)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let x = 10;
let y = x; // Copies the value
y = 20;
console.log(x); // 10 (original value remains unaffected)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;➕ Reference Data Types: Stored in the heap (dynamic memory allocation).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let obj1 = { name: 'Alice' };
let obj2 = obj1; // Copies the reference, not the value
obj2.name = 'Bob';
console.log(obj1.name); // "Bob" (original value is affected)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⌬ Mutability
&lt;/h2&gt;

&lt;p&gt;➕ Primitive Data Types: Immutable (cannot be changed after creation).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let str = "Hello";
str[0] = "h"; // No effect
console.log(str); // "Hello" (strings are immutable)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;➕ Reference Data Types: Mutable (values can be changed).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arr = [1, 2, 3];
arr[0] = 10;
console.log(arr); // [10, 2, 3]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⌬ Value vs Reference
&lt;/h2&gt;

&lt;p&gt;➕ Primitive Data Types: Stored as values. Directly hold the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let a = 5;
let b = a;
b = 10;
console.log(a); // 5 (original value is unaffected)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;➕ Reference Data Types: Stored as references to memory locations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let objA = { key: 'value' };
let objB = objA;
objB.key = 'newValue';
console.log(objA.key); // "newValue" (both reference the same object)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    JavaScript Data Types
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Type&lt;/th&gt;
        &lt;th&gt;Examples&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;Primitive Types&lt;/td&gt;
        &lt;td&gt;
          ➀ Number&lt;br&gt;
          ➁ String&lt;br&gt;
          ➂ Boolean&lt;br&gt;
          ➃ Undefined&lt;br&gt;
          ➄ Null
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Non-Primitive Types&lt;/td&gt;
        &lt;td&gt;
          ➀ Object&lt;br&gt;
          ➁ Array&lt;br&gt;
          ➂ Function
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  ❐ Now write Primitive type with deatils
&lt;/h2&gt;

&lt;p&gt;Primitive data types are immutable and stored by value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✚  Number&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age = 25; // Integer
let pi = 3.14159; // Floating-point
let negativeNumber = -42; // Negative number
let exponential = 1.23e4; // 12300 in exponential notatio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✚  String&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let singleQuote = 'Hello, world!';
let doubleQuote = "JavaScript is awesome!";
let templateLiteral = `This is a template literal`;

let multiLine = `This is a multi-line string.`;
console.log(`Name: ${singleQuote}, Length: ${singleQuote.length}`);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✚  Boolean&lt;/strong&gt;&lt;br&gt;
➭ Represents a logical value: true or false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let isJavaScriptFun = true;
let isOver18 = false;

console.log(typeof isJavaScriptFun); // "boolean"
console.log(5 &amp;gt; 2); // true
console.log(10 === '10'); // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✚   Undefined&lt;/strong&gt;&lt;br&gt;
➭ A variable is declared but not assigned a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let x;
console.log(x); // undefined
console.log(typeof x); // "undefined"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✚   Null&lt;/strong&gt;&lt;br&gt;
➭ Represents the intentional absence of any value (empty or unknown).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let y = null;
console.log(y); // null
console.log(typeof y); // "object" (this is a quirk in JavaScript)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ❐ Now write Non-Primitive type with deatils
&lt;/h2&gt;

&lt;p&gt;Non-primitive data types are mutable and stored by reference..&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✚   Object&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let person = {
  name: 'John',
  age: 30,
  isStudent: false,
  hobbies: ['reading', 'gaming'],
  address: {
    city: 'New York',
    zip: '10001',
  },
};

console.log(person.name); // "John"
console.log(person.address.city); // "New York"
console.log(typeof person); // "object"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✚   Array&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let fruits = ['Apple', 'Banana', 'Cherry'];
let mixedArray = [1, 'Hello', true, null, undefined];

console.log(fruits[0]); // "Apple"
console.log(mixedArray.length); // 5
console.log(typeof fruits); // "object" (arrays are objects in JS)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✚  Function&lt;/strong&gt;&lt;br&gt;
➭ Represents a logical value: true or false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function greet(name) {
  return `Hello, ${name}!`;
}

let sum = function(a, b) {
  return a + b;
};

let multiply = (x, y) =&amp;gt; x * y;

console.log(greet('Alice')); // "Hello, Alice!"
console.log(sum(3, 4)); // 7
console.log(multiply(5, 6)); // 30
console.log(typeof greet); // "function"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>learning</category>
      <category>programming</category>
    </item>
    <item>
      <title>🧷Ultimate Guide to Transforming Any Value into a String in JavaScript</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Sun, 29 Dec 2024 11:27:22 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/ultimate-guide-to-transforming-any-value-into-a-string-in-javascript-75l</link>
      <guid>https://forem.com/tanvir_ahamed/ultimate-guide-to-transforming-any-value-into-a-string-in-javascript-75l</guid>
      <description>&lt;p&gt;Converting values to strings is a fundamental task in JavaScript, useful for formatting, logging, or preparing data for display. This guide explores seven versatile methods to achieve this:&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;code&gt;String(value)&lt;/code&gt; - A simple and reliable way to turn anything into a string, even null or undefined&lt;/p&gt;

&lt;p&gt;2️⃣ &lt;code&gt;toString()&lt;/code&gt; - Works for most values but gives an error if you try it on null or undefined.&lt;/p&gt;

&lt;p&gt;3️⃣ &lt;code&gt;Template Literals&lt;/code&gt; - Use backticks (&lt;code&gt;${value}&lt;/code&gt;) to quickly and clearly turn a value into a string.&lt;/p&gt;

&lt;p&gt;4️⃣ &lt;code&gt;Concatenation (+ "")&lt;/code&gt; - Add an empty string to a value to change it into a string easily.&lt;/p&gt;

&lt;p&gt;5️⃣ &lt;code&gt;JSON.stringify()&lt;/code&gt; - Best for converting objects and arrays into a structured string format.&lt;/p&gt;




&lt;h2&gt;
  
  
  1️⃣ Using String()
&lt;/h2&gt;

&lt;p&gt;The String() function is the most straightforward way to convert a value to a string. It works for all types of values, including null and undefined.&lt;/p&gt;

&lt;p&gt;🚩Always works for any value&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9u1kuzzr2vaxusjouq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9u1kuzzr2vaxusjouq7.png" alt="Image description" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2️⃣ Using toString()
&lt;/h2&gt;

&lt;p&gt;The .toString() method is available on most data types, including numbers, booleans, arrays, and objects. However, it cannot be used directly on null or undefined, which will throw an error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyg646p6pomy4qwnhjai2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyg646p6pomy4qwnhjai2.png" alt="Image description" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3️⃣ Using Template Literals
&lt;/h2&gt;

&lt;p&gt;Template literals (&lt;code&gt;${value}&lt;/code&gt;) are an implicit way to convert values to strings. They use the default string conversion of the value, making it a clean and concise option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hn8h27h8qa8toj77wai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hn8h27h8qa8toj77wai.png" alt="Image description" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4️⃣ Using + "" (Concatenation with Empty String)
&lt;/h2&gt;

&lt;p&gt;By concatenating a value with an empty string, JavaScript implicitly converts the value to a string.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5uht8o5337g72emmxhax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5uht8o5337g72emmxhax.png" alt="Image description" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5️⃣ Using JSON.stringify()
&lt;/h2&gt;

&lt;p&gt;JSON.stringify() converts values into a JSON-formatted string. This is particularly useful for arrays and objects where you want to maintain their structure in the string format.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3goqgs4ipt17x0ya4kci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3goqgs4ipt17x0ya4kci.png" alt="Image description" width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🚀 Master the Most Powerful JavaScript String Methods (With Real-World Examples)</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Tue, 24 Dec 2024 07:40:16 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/master-the-most-powerful-javascript-string-methods-with-real-world-examples-47mp</link>
      <guid>https://forem.com/tanvir_ahamed/master-the-most-powerful-javascript-string-methods-with-real-world-examples-47mp</guid>
      <description>&lt;h2&gt;
  
  
  Key Features of JavaScript String Methods
&lt;/h2&gt;

&lt;p&gt;✅ &lt;strong&gt;Immutability:&lt;/strong&gt; Strings in JavaScript are immutable, meaning their original value cannot be changed. String methods return a new string or value without altering the original string.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Case Sensitivity:&lt;/strong&gt; String methods are case-sensitive. For example, "Hello" and "hello" are treated as different strings.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Chaining Methods:&lt;/strong&gt; String methods can be chained together to perform multiple operations in a single line of code.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Regular Expressions:&lt;/strong&gt; Many string methods, such as match(), replace(), and split(), support regular expressions for advanced pattern matching and manipulation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Now List String Method
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;No&lt;/th&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;01&lt;/td&gt;
&lt;td&gt;toUpperCase()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;02&lt;/td&gt;
&lt;td&gt;toLowerCase()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;03&lt;/td&gt;
&lt;td&gt;trim()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;04&lt;/td&gt;
&lt;td&gt;charAt()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;05&lt;/td&gt;
&lt;td&gt;split()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;06&lt;/td&gt;
&lt;td&gt;concat()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;07&lt;/td&gt;
&lt;td&gt;slice()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;08&lt;/td&gt;
&lt;td&gt;replace()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;09&lt;/td&gt;
&lt;td&gt;include()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;repeat()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;indexOf()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;startWith() &amp;amp; endsWith()&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  1.toUpperCase():
&lt;/h2&gt;

&lt;p&gt;The toUpperCase() method is used to convert all the alphabetic characters in a string to uppercase. Non-alphabetic characters, such as numbers, spaces, or symbols, remain unchanged.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;syntax: string.toUpperCase();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fro4pu4zkbetsohvhen6w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fro4pu4zkbetsohvhen6w.png" alt="Image description" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2.toLowerCase():
&lt;/h2&gt;

&lt;p&gt;The toLowerCase() method is used to convert all the alphabetic characters in a string to lowercase. Like toUpperCase(), non-alphabetic characters remain unchanged.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;syntax: string.toLowerCase();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsd878s3h6quq57naoc7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsd878s3h6quq57naoc7y.png" alt="Image description" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3.trim():
&lt;/h2&gt;

&lt;p&gt;The trim() method in JavaScript is used to remove whitespace from both the beginning and the end of a string. Whitespace characters include spaces, tabs, and newline characters.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;syntax: string.trim;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn5qv4pb1r0thdp024plr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn5qv4pb1r0thdp024plr.png" alt="Image description" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4.charAt():
&lt;/h2&gt;

&lt;p&gt;The charAt() method in JavaScript is used to retrieve a character at a specific index in a string. It returns the character at the given position, or an empty string if the index is out of range.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;syntax: string.charAt();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92358cbcmwx6weyc1e5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92358cbcmwx6weyc1e5q.png" alt="Image description" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5.split():
&lt;/h2&gt;

&lt;p&gt;The split() method in JavaScript is used to divide a string into an array of substrings based on a specified separator. It splits the string wherever the separator occurs and returns a new array with the resulting substrings.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;syntax: string.split([separator[, limit]]);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frfk7ihoo48izsrmlkex6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frfk7ihoo48izsrmlkex6.png" alt="Image description" width="800" height="747"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6.concat():
&lt;/h2&gt;

&lt;p&gt;The concat() method in JavaScript is used to merge two or more arrays or strings into a new array or string. It does not modify the original array or string, but instead returns a new one that contains the merged data.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string1.concat(string2, string3, ..., stringN);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funjlsru3wi6kyhl3jvo8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Funjlsru3wi6kyhl3jvo8.png" alt="Image description" width="800" height="1042"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7.slice():
&lt;/h2&gt;

&lt;p&gt;The slice() method in JavaScript extracts a section of an array or string and returns it as a new array or string, without modifying the original array or string.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string.slice(start, end);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqkiztr88kvdupp7g3yas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqkiztr88kvdupp7g3yas.png" alt="Image description" width="800" height="712"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  8.replace():
&lt;/h2&gt;

&lt;p&gt;The replace() method in JavaScript allows you to replace parts of a string with another string. It works with both strings and regular expressions.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string.replace(pattern, replacement)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4opntww5ujy43t49kkhc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4opntww5ujy43t49kkhc.png" alt="Image description" width="800" height="971"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  9.include():
&lt;/h2&gt;

&lt;p&gt;The includes() method determines whether a string contains a specified substring, returning true or false based on the presence of the substring.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Features&lt;/code&gt;&lt;br&gt;
i.Case-Sensitive: The includes() method is case-sensitive.&lt;br&gt;
ii.Boolean Result: Returns a true or false.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string.includes(searchString, position)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnzj8nvg9bt9cdzqn3va.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftnzj8nvg9bt9cdzqn3va.png" alt="Image description" width="800" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  10.repeat():
&lt;/h2&gt;

&lt;p&gt;The repeat() method constructs and returns a new string, consisting of the specified number of copies of the original string, concatenated together.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string.repeat(count)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5crcag1rv6qtlx0mjgra.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5crcag1rv6qtlx0mjgra.png" alt="Image description" width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  11.indexOf():
&lt;/h2&gt;

&lt;p&gt;The indexOf() method in JavaScript is used to determine the first occurrence of a specified substring within a string. It returns the index of the first occurrence of the substring. If the substring is not found, it returns -1.&lt;/p&gt;

&lt;p&gt;Return Value:&lt;br&gt;
The index of the first occurrence of searchValue.-1 if searchValue is not found.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string.indexOf(searchValue, fromIndex)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F236j6stcayte6r1ry889.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F236j6stcayte6r1ry889.png" alt="Image description" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  12.startWith() &amp;amp; endsWith():
&lt;/h2&gt;

&lt;p&gt;The startsWith() and endsWith() methods in JavaScript are used to check whether a string begins or ends with a specified substring. Both methods return a boolean (true or false).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;string.startsWith(searchString, position)&lt;br&gt;
 string.endsWith(searchString, length)&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F826hb55f0clkkvuc6vmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F826hb55f0clkkvuc6vmh.png" alt="Image description" width="800" height="1046"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>What is the difference between Null and undefined in JavaScript?</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Fri, 18 Oct 2024 16:56:44 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/what-is-the-difference-between-null-nan-and-undefined-in-javascript-2g6i</link>
      <guid>https://forem.com/tanvir_ahamed/what-is-the-difference-between-null-nan-and-undefined-in-javascript-2g6i</guid>
      <description>&lt;h2&gt;
  
  
  Null
&lt;/h2&gt;

&lt;p&gt;In JavaScript, null is a &lt;strong&gt;primitive value&lt;/strong&gt; that represents the intentional absence of any object value. It is one of JavaScript's falsy values, meaning it evaluates to false in boolean contexts. However, it is &lt;strong&gt;distinct from undefined&lt;/strong&gt;, which represents a variable that has been declared but has not been assigned a value.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;null is a special primitive value, but when you check its type using typeof, it returns "object". &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7im4kd0lherxpg383u8p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7im4kd0lherxpg383u8p.png" alt="Image description" width="800" height="233"&gt;&lt;/a&gt;&lt;br&gt;
null is used when a variable is expected to hold an object but currently doesn't have one. It signals the intentional absence of a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let person = null;  // The `person` variable explicitly has no value.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Used when you intentionally want to signify "no value" or "empty."&lt;/p&gt;




&lt;h1&gt;
  
  
  Undefined
&lt;/h1&gt;

&lt;p&gt;In JavaScript, undefined is a primitive value automatically assigned to variables that have been declared but not yet assigned a value. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;undefined is a primitive type in JavaScript. It refers to variables that have been declared but not initialized, and its typeof will correctly reflect "undefined".
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let x;
console.log(typeof x);         // "undefined"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Difference Between null and undefined
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq4abuuctnuzf7x6etho9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq4abuuctnuzf7x6etho9.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
In this example, uninitializedVariable is undefined because it hasn't been assigned any value.&lt;br&gt;
Meanwhile, objectWithNoValue is explicitly set to null, signaling that it should hold an object, but currently it doesn’t.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Loose equality (==)&lt;/code&gt; null and undefined are loosely equal because they both represent an "empty" value.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(null == undefined);  // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Strict equality (===)&lt;/code&gt; They are not strictly equal because they are different types.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(null == undefined);  // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>programming</category>
      <category>coding</category>
    </item>
    <item>
      <title>JavaScript Equals: JavaScript ‘===’ vs ‘==’Comparison Operator</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Thu, 17 Oct 2024 13:06:30 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/equality-operator-a-javascript-guide-48k2</link>
      <guid>https://forem.com/tanvir_ahamed/equality-operator-a-javascript-guide-48k2</guid>
      <description>&lt;p&gt;In JavaScript, the equality operators "==" and "===" are used to compare two values, but they work differently in terms of how they handle data types. Here’s a simple explanation:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. == (Loose Equality):
&lt;/h2&gt;

&lt;p&gt;The JavaScript equals or loose equality operator ( == ) checks if two variables or values are equal. It returns true if two values are of equal value, even if they're of different types. Conversely, it returns false if the values aren't of equal value.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wqronfbiv0jid454grq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wqronfbiv0jid454grq.png" alt="Image description" width="800" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, JavaScript converts the string '1' into a number 1 and then compares them, so it returns true.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it does:&lt;/strong&gt; It checks if two values are equal, but ignores the data type.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type conversion (coercion):&lt;/strong&gt; JavaScript automatically converts one or both values to the same type before comparing them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Others Example:&lt;/p&gt;

&lt;p&gt;i).  &lt;code&gt;0 == false&lt;/code&gt; is true (because false is converted to 0)&lt;br&gt;
ii). &lt;code&gt;null == undefined&lt;/code&gt; is true (they are considered loosely equal)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; This automatic type conversion can sometimes lead to unexpected results, so it’s generally considered less reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. === (Strict Equality):
&lt;/h2&gt;

&lt;p&gt;The strict equality (===) operator checks whether its two operands are equal, returning a Boolean result. Unlike the equality operator, the strict equality operator always considers operands of different types to be different.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy85d45jfrrn0rro3qa7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy85d45jfrrn0rro3qa7f.png" alt="Image description" width="800" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, JavaScript does not convert the string '1' into a number. Since 1 is a number and '1' is a string, it returns false.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What it does:&lt;/strong&gt; It checks if two values are exactly equal, including both the value and the data type.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Type conversion:&lt;/strong&gt; It does not perform type conversion; the types must match for the comparison to return true.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Others Example:&lt;/p&gt;

&lt;p&gt;i).  &lt;code&gt;0 == false&lt;/code&gt; is false (because 0 is a number and false is a boolean)&lt;br&gt;
ii). &lt;code&gt;null == undefined&lt;/code&gt; is false (they are of different types)&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;== (loose equality) compares values after converting them to the same type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;=== (strict equality) compares values without any type conversion.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>Exploring the Core of true value vs false value in JavaScript...</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Thu, 17 Oct 2024 04:20:49 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/exploring-the-core-of-true-value-vs-false-value-in-javascript-40p</link>
      <guid>https://forem.com/tanvir_ahamed/exploring-the-core-of-true-value-vs-false-value-in-javascript-40p</guid>
      <description>&lt;h2&gt;
  
  
  Truthy Value
&lt;/h2&gt;

&lt;p&gt;In JavaScript, a truthy value is any value that is considered true when evaluated in a Boolean context. Values that are not falsy are considered truthy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example of truthy values:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Any non-zero number (1,-5,3.14)&lt;/li&gt;
&lt;li&gt;Non-empty strings ("hello" )&lt;/li&gt;
&lt;li&gt;space value(" ")&lt;/li&gt;
&lt;li&gt;Objects ({}, [])&lt;/li&gt;
&lt;li&gt;The boolean true&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Now Example,
&lt;/h2&gt;

&lt;p&gt;1.Checking a Non-empty String:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fac6zff88ibwzpo9aq1po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fac6zff88ibwzpo9aq1po.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explanation: The string "JavaScript" is a non-empty string, so it evaluates to true.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.Checking a String with a Space:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqi3mr8to09lyd2yqgjb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqi3mr8to09lyd2yqgjb9.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explanation: The string " " (a string containing a space) is also a non-empty string, which evaluates to true.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.Checking a Positive Number:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8lv22qcn2mh7ngbbpvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8lv22qcn2mh7ngbbpvf.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explanation: The number 100 is a non-zero number, so it evaluates to true.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4.Checking a Negative Number:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftogfmhjrg0ne3wusjwrv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftogfmhjrg0ne3wusjwrv.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explanation: The number -5 is also a non-zero number, making it truthy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5.Checking an Empty Array &amp;amp; Object:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxazxu1b7jcwsw6tn4r0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxazxu1b7jcwsw6tn4r0a.png" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explanation: An empty array [] is considered truthy in JavaScript.&lt;/li&gt;
&lt;li&gt;Explanation: An empty object {} is also considered truthy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;6.Checking the Boolean True:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0h6t3v84up49b10hr6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd0h6t3v84up49b10hr6l.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explanation: The boolean value true is, by definition, truthy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Falsy Value
&lt;/h2&gt;

&lt;p&gt;A falsy value is something which evaluates to FALSE, for instance when checking a variable. &lt;/p&gt;

&lt;h2&gt;
  
  
  Example of falsy values:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;0 zero &amp;amp;&amp;amp; (-0) negative zero&lt;/li&gt;
&lt;li&gt;empty strings ("" )&lt;/li&gt;
&lt;li&gt;null,undefine &amp;amp; Nan&lt;/li&gt;
&lt;li&gt;The boolean false&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Now Example,
&lt;/h2&gt;

&lt;p&gt;Part01&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2f8vmeaacf3fnsah11b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2f8vmeaacf3fnsah11b.png" alt="Image description" width="800" height="709"&gt;&lt;/a&gt;&lt;br&gt;
Part02&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1n5ldidveu2i1821n7m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa1n5ldidveu2i1821n7m.png" alt="Image description" width="800" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>challenge</category>
    </item>
    <item>
      <title>JavaScript uses three dots (...) for both the rest and spread operators. But these two operators are not the same.</title>
      <dc:creator>Tanvir Ahmed</dc:creator>
      <pubDate>Sat, 12 Oct 2024 17:15:30 +0000</pubDate>
      <link>https://forem.com/tanvir_ahamed/javascript-spread-operator-286e</link>
      <guid>https://forem.com/tanvir_ahamed/javascript-spread-operator-286e</guid>
      <description>&lt;h2&gt;
  
  
  Spread Operator:
&lt;/h2&gt;

&lt;p&gt;The spread operator is used to break apart items in things like arrays, strings, or objects into individual pieces. It's often used to copy or join arrays, or to pass the items in an array as separate arguments to a function.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;# 1.0 Array&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;u&gt;1.1 Copy an array:&lt;/u&gt;&lt;br&gt;
Instead of modifying the original array, you can create a shallow copy of an array.&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdor1r6bzmb1m0vaq5xjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdor1r6bzmb1m0vaq5xjh.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;1.2 Concatenating arrays:&lt;/u&gt;&lt;br&gt;
Using the spread operator, you can concatenate arrays easily without using .concat().&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgre19fe26hpwzf4wa38s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgre19fe26hpwzf4wa38s.png" alt="Image description" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;1.3 Adding elements to an array:&lt;/u&gt;&lt;br&gt;
You can easily add new elements to an array using the spread operator.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyu9py4a6zp46oa8r1iau.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyu9py4a6zp46oa8r1iau.png" alt="Image description" width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;# 2.0 Object&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;u&gt;2.1 Copy an object:&lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh8brrejnvceqhykorpr1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh8brrejnvceqhykorpr1.png" alt="Image description" width="800" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;2.2 Merging object:&lt;/u&gt;&lt;br&gt;
The spread operator allows you to merge two or more objects. If there are conflicting properties, the properties of the object that appears later will overwrite the previous ones.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvpn95vtramahq14ka1a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzvpn95vtramahq14ka1a.png" alt="Image description" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;# 3.0 Function&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;u&gt;3.1 Using Spread in Function Calls :&lt;/u&gt;&lt;br&gt;
You can use the spread operator to pass an array as individual arguments to a function.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuc22rj2njb2lc78ifwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmuc22rj2njb2lc78ifwg.png" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Rest Operator:
&lt;/h2&gt;

&lt;p&gt;The JavaScript Rest parameter allows a function to accept an indefinite number of arguments as an array. It is represented by three dots (…) followed by the parameter name and must be the last parameter in the function, enabling flexible and dynamic argument handling.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Default behavior: &lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzpdp1qcr7gcdmmtclx7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzpdp1qcr7gcdmmtclx7.png" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;br&gt;
&lt;u&gt; All value support : &lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgkmgd69j3tc3l3896880.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgkmgd69j3tc3l3896880.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;u&gt; Specific  value  work using array index : &lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesjapvqy6qpa4t6ur8x4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fesjapvqy6qpa4t6ur8x4.png" alt="Image description" width="800" height="296"&gt;&lt;/a&gt;&lt;br&gt;
&lt;u&gt; Since the rest parameter generates an array, the map will work : &lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hxrwyx0kun4zs05tfqn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1hxrwyx0kun4zs05tfqn.png" alt="Image description" width="800" height="435"&gt;&lt;/a&gt;&lt;br&gt;
&lt;u&gt; Combining Arguments Dynamically : &lt;/u&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi2iyxhu4psjoiubmyvze.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi2iyxhu4psjoiubmyvze.png" alt="Image description" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use the Rest and Spread Operator
&lt;/h2&gt;

&lt;p&gt;Use the &lt;strong&gt;rest operator&lt;/strong&gt; when handling an unknown number of function arguments or collecting remaining elements in array/object destructuring. The &lt;strong&gt;spread operator&lt;/strong&gt; is ideal for expanding arrays/objects into individual elements or passing array items as function arguments.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Table
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2dpkmr1zddlfg5tc1oy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2dpkmr1zddlfg5tc1oy.png" alt="Image description" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Rest vs Spread Operator
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;rest operator&lt;/strong&gt; gathers multiple elements into an array or object, ideal for handling variable arguments in functions or array/object destructuring. The &lt;strong&gt;spread operator&lt;/strong&gt; expands elements from arrays, objects, or strings, simplifying tasks like copying, concatenation, or passing array elements as separate arguments in function calls.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>learning</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
