<?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>DEV Community: Fahad ahmad</title>
    <description>The latest articles on DEV Community by Fahad ahmad (@pdevfahad).</description>
    <link>https://dev.to/pdevfahad</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%2F778876%2F0e1baf6e-61a5-435a-a2f9-b4002baa32f0.jpg</url>
      <title>DEV Community: Fahad ahmad</title>
      <link>https://dev.to/pdevfahad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pdevfahad"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Tue, 03 Feb 2026 05:53:11 +0000</pubDate>
      <link>https://dev.to/pdevfahad/-mpg</link>
      <guid>https://dev.to/pdevfahad/-mpg</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/pdevfahad" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F778876%2F0e1baf6e-61a5-435a-a2f9-b4002baa32f0.jpg" alt="pdevfahad"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/pdevfahad/why-most-habit-trackers-fail-and-how-an-expiry-system-fixed-my-discipline-2f7m" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Why Most Habit Trackers Fail (and How an “Expiry System” Fixed My Discipline)&lt;/h2&gt;
      &lt;h3&gt;Fahad ahmad ・ Feb 2&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#hackathon&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#saas&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#developer&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>productivity</category>
      <category>hackathon</category>
      <category>saas</category>
      <category>developer</category>
    </item>
    <item>
      <title>Why Most Habit Trackers Fail (and How an “Expiry System” Fixed My Discipline)</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Mon, 02 Feb 2026 17:57:53 +0000</pubDate>
      <link>https://dev.to/pdevfahad/why-most-habit-trackers-fail-and-how-an-expiry-system-fixed-my-discipline-2f7m</link>
      <guid>https://dev.to/pdevfahad/why-most-habit-trackers-fail-and-how-an-expiry-system-fixed-my-discipline-2f7m</guid>
      <description>&lt;p&gt;Starting a habit is easy.&lt;br&gt;
Sticking to it is painful.&lt;/p&gt;

&lt;p&gt;As developers, builders, and busy people, we all know this problem too well.&lt;/p&gt;

&lt;p&gt;You decide to:&lt;/p&gt;

&lt;p&gt;Code every day&lt;/p&gt;

&lt;p&gt;Read 10 pages daily&lt;/p&gt;

&lt;p&gt;Exercise regularly&lt;/p&gt;

&lt;p&gt;Learn a new skill&lt;/p&gt;

&lt;p&gt;Day 1 feels amazing.&lt;br&gt;
Day 3 is okay.&lt;br&gt;
Then one busy day comes… and you forget.&lt;/p&gt;

&lt;p&gt;That one missed day slowly turns into a broken habit.&lt;/p&gt;

&lt;p&gt;The Real Problem With Habits (No One Talks About This)&lt;/p&gt;

&lt;p&gt;Most habit trackers focus on streaks and motivation.&lt;/p&gt;

&lt;p&gt;But motivation is unreliable.&lt;br&gt;
Streaks break easily.&lt;/p&gt;

&lt;p&gt;The real reason habits fail is simple:&lt;/p&gt;

&lt;p&gt;We forget at the right moment.&lt;/p&gt;

&lt;p&gt;Not because we are lazy.&lt;br&gt;
Not because we don’t care.&lt;br&gt;
But because life gets busy and reminders come too late.&lt;/p&gt;

&lt;p&gt;You remember after the habit expired.&lt;br&gt;
And then guilt kicks in.&lt;br&gt;
And then you quit.&lt;/p&gt;

&lt;p&gt;Why I Stopped Using Traditional Habit Trackers&lt;/p&gt;

&lt;p&gt;I tried many habit apps.&lt;/p&gt;

&lt;p&gt;They all had:&lt;/p&gt;

&lt;p&gt;Charts&lt;/p&gt;

&lt;p&gt;Streaks&lt;/p&gt;

&lt;p&gt;Fancy dashboards&lt;/p&gt;

&lt;p&gt;But they didn’t solve my real pain:&lt;br&gt;
👉 Timely reminders before failure&lt;/p&gt;

&lt;p&gt;Most apps notify you after you miss a habit.&lt;br&gt;
By then, the damage is already done.&lt;/p&gt;

&lt;p&gt;I needed something that would warn me before my habit expires.&lt;/p&gt;

&lt;p&gt;The Idea: Treat Habits Like Expiring Tasks&lt;/p&gt;

&lt;p&gt;That’s when I thought:&lt;/p&gt;

&lt;p&gt;What if habits worked like expiring items?&lt;/p&gt;

&lt;p&gt;Just like:&lt;/p&gt;

&lt;p&gt;OTPs expire&lt;/p&gt;

&lt;p&gt;Sessions expire&lt;/p&gt;

&lt;p&gt;Deadlines expire&lt;/p&gt;

&lt;p&gt;Why not habits?&lt;/p&gt;

&lt;p&gt;So instead of saying:&lt;/p&gt;

&lt;p&gt;“You failed today”&lt;/p&gt;

&lt;p&gt;The system should say:&lt;/p&gt;

&lt;p&gt;“Hey, your habit is about to expire.”&lt;/p&gt;

&lt;p&gt;That small change makes a huge difference.&lt;/p&gt;

&lt;p&gt;Introducing Expirel – A Different Way to Build Habits&lt;/p&gt;

&lt;p&gt;I built Expirel with one simple idea:&lt;/p&gt;

&lt;p&gt;Remind people before habits expire, not after they fail.&lt;/p&gt;

&lt;p&gt;Expirel is a habit and expiry tracker that:&lt;/p&gt;

&lt;p&gt;Sends email reminders&lt;/p&gt;

&lt;p&gt;Sends WhatsApp reminders&lt;/p&gt;

&lt;p&gt;Alerts you before your habit time runs out&lt;/p&gt;

&lt;p&gt;No pressure.&lt;br&gt;
No guilt.&lt;br&gt;
Just a gentle nudge at the right time.&lt;/p&gt;

&lt;p&gt;👉 Try it here: &lt;a href="https://dev.toExpirel"&gt;https://expirel.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why Developers Love This Approach&lt;/p&gt;

&lt;p&gt;Developers understand systems.&lt;/p&gt;

&lt;p&gt;And this is a system-level fix, not motivation talk.&lt;/p&gt;

&lt;p&gt;Less cognitive load&lt;/p&gt;

&lt;p&gt;No constant app checking&lt;/p&gt;

&lt;p&gt;Works quietly in the background&lt;/p&gt;

&lt;p&gt;Respects your time&lt;/p&gt;

&lt;p&gt;You don’t need more willpower.&lt;br&gt;
You need better timing.&lt;/p&gt;

&lt;p&gt;This Isn’t Just for Developers&lt;/p&gt;

&lt;p&gt;Expirel is for anyone who:&lt;/p&gt;

&lt;p&gt;Keeps restarting habits&lt;/p&gt;

&lt;p&gt;Forgets daily goals&lt;/p&gt;

&lt;p&gt;Feels bad after missing one day&lt;/p&gt;

&lt;p&gt;Wants consistency without stress&lt;/p&gt;

&lt;p&gt;If you’re tired of “Day 1 again”, this approach will feel different.&lt;/p&gt;

&lt;p&gt;Discipline Is Built With Systems, Not Motivation&lt;/p&gt;

&lt;p&gt;Motivation fades.&lt;br&gt;
Systems stay.&lt;/p&gt;

&lt;p&gt;When reminders arrive before failure, habits become easier.&lt;br&gt;
Consistency becomes natural.&lt;br&gt;
And progress finally sticks.&lt;/p&gt;

&lt;p&gt;If you want to stop restarting and start moving forward, give Expirel a try.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://expirel.com" rel="noopener noreferrer"&gt;https://expirel.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your habits shouldn’t expire silently.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>hackathon</category>
      <category>saas</category>
      <category>developer</category>
    </item>
    <item>
      <title>Easily Calculate Your Investment Returns with This Free Tool</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Mon, 25 Aug 2025 09:50:25 +0000</pubDate>
      <link>https://dev.to/pdevfahad/easily-calculate-your-investment-returns-with-this-free-tool-4khm</link>
      <guid>https://dev.to/pdevfahad/easily-calculate-your-investment-returns-with-this-free-tool-4khm</guid>
      <description>&lt;p&gt;Planning your financial future can feel complicated, especially when you factor in compound interest and annual contributions. That’s why I created a Free Investment Calculator to make it simple for everyone.&lt;/p&gt;

&lt;p&gt;👉 Try it now: &lt;a href="https://calculatorskit.net/calculators/investment-calculator" rel="noopener noreferrer"&gt;Investment Calculator&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use an Investment Calculator?
&lt;/h2&gt;

&lt;p&gt;✅ Quick and Easy – No complex math, just enter your numbers.&lt;/p&gt;

&lt;p&gt;✅ Understand Compound Interest – See how your money grows over time.&lt;/p&gt;

&lt;p&gt;✅ Plan Your Future – Set realistic financial goals.&lt;/p&gt;

&lt;p&gt;How It Works&lt;/p&gt;

&lt;p&gt;Enter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initial Investment&lt;/li&gt;
&lt;li&gt;Years&lt;/li&gt;
&lt;li&gt;Annual Contribution&lt;/li&gt;
&lt;li&gt;Expected Annual Return&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click Calculate, and you’ll instantly see your future value.&lt;/p&gt;

&lt;p&gt;👉 Calculate yours now: &lt;a href="https://calculatorskit.net/calculators/investment-calculator" rel="noopener noreferrer"&gt;Free Investment Calculator&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Automate Work Hour Tracking with a Free Time Card Calculator</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Fri, 25 Jul 2025 12:04:11 +0000</pubDate>
      <link>https://dev.to/pdevfahad/automate-work-hour-tracking-with-a-free-time-card-calculator-40jh</link>
      <guid>https://dev.to/pdevfahad/automate-work-hour-tracking-with-a-free-time-card-calculator-40jh</guid>
      <description>&lt;p&gt;As a developer, freelancer, or team manager, tracking work hours accurately is crucial—whether for payroll, client billing, or productivity analysis. Manual calculations are error-prone and time-consuming. That’s where a free &lt;a href="https://calculatorskit.net/calculators/time-card-calculator" rel="noopener noreferrer"&gt;time card calculator&lt;/a&gt; comes in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Developers &amp;amp; Teams Need a Time Card Calculator
&lt;/h2&gt;

&lt;p&gt;✅ No More Spreadsheet Headaches – Ditch manual Excel formulas.&lt;br&gt;
✅ Overtime Compliance – Automatically applies 1.5x/2x rules.&lt;br&gt;
✅ Exportable Data – Generate timesheets for payroll or clients.&lt;br&gt;
✅ Open Access – No signup required (unlike some SaaS tools).&lt;/p&gt;
&lt;h2&gt;
  
  
  Try This Free Time Card Calculator
&lt;/h2&gt;

&lt;p&gt;I built a simple, no-nonsense &lt;a href="https://calculatorskit.net/calculators/time-card-calculator" rel="noopener noreferrer"&gt;Time Card Calculator&lt;/a&gt; that handles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Clock-in/out with break deductions  
2. Overtime calculations (adjustable thresholds)  
3. Gross pay estimates  
4. Printable PDF timesheets  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Who Benefits?
&lt;/h2&gt;

&lt;p&gt;Freelancers – Bill clients accurately.&lt;br&gt;
Remote Teams – Sync across &lt;a href="https://calculatorskit.net/calculators/time-zone-calculator" rel="noopener noreferrer"&gt;timezones&lt;/a&gt;.&lt;br&gt;
Open-Source Projects – Track contributor hours.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>ai</category>
    </item>
    <item>
      <title>How to create drag and drop in reactjs</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Mon, 10 Apr 2023 08:52:58 +0000</pubDate>
      <link>https://dev.to/pdevfahad/how-to-create-drag-and-drop-in-reactjs-1go9</link>
      <guid>https://dev.to/pdevfahad/how-to-create-drag-and-drop-in-reactjs-1go9</guid>
      <description>&lt;p&gt;To create drag and drop functionality in React JS, you can use the HTML5 Drag and Drop API which allows elements to be dragged and dropped within a web page.&lt;/p&gt;

&lt;p&gt;Here are the basic steps to create a drag and drop feature in React JS:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create two components: one for the element that will be dragged, and another for the drop target.&lt;/li&gt;
&lt;li&gt;In the component for the element that will be dragged, add an event handler for "onDragStart" that sets the data for the drag operation using the "setData" method of the event object.&lt;/li&gt;
&lt;li&gt;Add event handlers for "onDragOver" and "onDrop" in the component for the drop target.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For detail reading please visit given link: &lt;br&gt;
&lt;a href="https://vocal.media/education/how-to-create-drag-and-drop-in-reactjs" rel="noopener noreferrer"&gt;Click me for complete details&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to make money on Shutterstock.</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Thu, 16 Mar 2023 09:38:07 +0000</pubDate>
      <link>https://dev.to/pdevfahad/how-to-make-money-on-shutterstock-aj9</link>
      <guid>https://dev.to/pdevfahad/how-to-make-money-on-shutterstock-aj9</guid>
      <description>&lt;p&gt;&lt;a href="https://submit.shutterstock.com/?rid=382633337&amp;amp;language=en" rel="noopener noreferrer"&gt;Shutterstock&lt;/a&gt; is a popular platform where photographers, videographers, and other creatives can earn money by selling their content, such as photos, illustrations, and videos, to clients around the world.&lt;/p&gt;

&lt;p&gt;Here are some steps you can take to earn money through &lt;a href="https://submit.shutterstock.com/?rid=382633337&amp;amp;language=en" rel="noopener noreferrer"&gt;Shutterstock&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign up as a contributor: Create an account on &lt;a href="https://submit.shutterstock.com/?rid=382633337&amp;amp;language=en" rel="noopener noreferrer"&gt;Shutterstock&lt;/a&gt; and sign up as a contributor. You will need to submit your personal details and some sample content for review. For create &lt;a href="https://submit.shutterstock.com/?rid=382633337&amp;amp;language=en" rel="noopener noreferrer"&gt;Shutterstock&lt;/a&gt; account click me&lt;/li&gt;
&lt;li&gt;Upload your content: Once you are approved as a contributor, start uploading your high-quality photos, illustrations, and videos. Make sure your content meets the quality standards of Shutterstock.&lt;/li&gt;
&lt;li&gt;Keyword your content: Use relevant keywords and descriptions to help clients find your content easily. This will increase the chances of your content being purchased.&lt;/li&gt;
&lt;li&gt;Earn royalties: Shutterstock pays contributors a royalty each time a client downloads their content. The amount you earn will depend on the license type and subscription plan the client has purchased.&lt;/li&gt;
&lt;li&gt;Promote your content: You can promote your content on social media and other platforms to increase its visibility and attract potential clients.
Remember, earning money through Shutterstock requires dedication, effort, and patience. Keep uploading new and unique content and improve your skills to increase your chances of success.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>money</category>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Top JavaScript Array Methods with Examples</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Fri, 18 Feb 2022 10:42:50 +0000</pubDate>
      <link>https://dev.to/pdevfahad/top-javascript-array-methods-with-examples-2kj8</link>
      <guid>https://dev.to/pdevfahad/top-javascript-array-methods-with-examples-2kj8</guid>
      <description>&lt;p&gt;In programming, an array is a collection of elements or items. Arrays store data as elements and retrieve them back when you need them.&lt;br&gt;
The array data structure is widely used in all programming languages that support it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Did I Write this Article?
&lt;/h2&gt;

&lt;p&gt;There are many great articles on JavaScript arrays already available around the internet. So why did I write yet another article on the same subject? What’s the motivation?&lt;br&gt;
Well, over the years of interacting with my mentees, I realized that most beginners need a tutorial that covers arrays thoroughly from beginning to end with examples.&lt;br&gt;
So I decided to create such an article chock full of meaningful examples. If you are a beginner at JavaScript, I hope you’ll find it very helpful.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an Array in JavaScript?
&lt;/h2&gt;

&lt;p&gt;A pair of square brackets [] represents an array in JavaScript. All the elements in the array are comma(,) separated.&lt;br&gt;
In JavaScript, arrays can be a collection of elements of any type. This means that you can create an array with elements of type String, Boolean, Number, Objects, and even other Arrays.&lt;br&gt;
Here is an example of an array with four elements: type Number, Boolean, String, and Object.&lt;br&gt;
&lt;code&gt;const mixedTypedArray = [100, true, 'freeCodeCamp', {}];&lt;/code&gt;&lt;br&gt;
The position of an element in the array is known as its index. In JavaScript, the array index starts with 0, and it increases by one with each element.&lt;br&gt;
So, for example, in the above array, the element 100 is at index 0, true is at &lt;code&gt;index 1&lt;/code&gt;, 'freeCodeCamp' is at &lt;code&gt;index 2&lt;/code&gt;, and so on.&lt;br&gt;
The number of elements in the array determines its length. For example, the length of the above array is four.&lt;br&gt;
Interestingly, JavaScript arrays are not of fixed length. You can change the length anytime by assigning a positive numeric value. We will learn more about that in a while.&lt;br&gt;
&lt;code&gt;How to Create an Array in JavaScript&lt;/code&gt;&lt;br&gt;
You can create an array in multiple ways in JavaScript. The most straightforward way is by assigning an array value to a variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add Element in Array
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;unshift()&lt;/code&gt; the method adds a new element to an array (at the beginning), and "unshifts" older elements:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = [“Orange”, “Apple”, “Mango”, “Banana”,];&lt;br&gt;
fruits.unshift(“Lemon”);&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;push()&lt;/code&gt; the method adds a new element to an array (at the end):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = [“Orange”, “Apple”, “Mango”, “Banana”,];&lt;br&gt;
fruits.push(“lemon”);&lt;br&gt;
console.log(fruits);&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Delete Element
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;shift()&lt;/code&gt; the method removes the first array element and "shifts" all other elements to a lower index.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = [“Banana”, “Orange”, “Apple”, “Mango”];&lt;br&gt;
fruits.shift();&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;pop()&lt;/code&gt; the method removes the last element from an array:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = [“Banana”, “Orange”, “Apple”, “Mango”];&lt;br&gt;
fruits.pop();&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;slice()&lt;/code&gt; method slices out a piece of an array into a new array.&lt;br&gt;
This example slices out a part of an array starting from array element 1 (“Orange”):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = [“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”];&lt;br&gt;
const citrus = fruits.slice(1);&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;slice()&lt;/code&gt; the method creates a new array. It does not remove any elements from the source array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Filter Elements
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;filter()&lt;/code&gt; the method creates a new array filled with elements that pass a test provided by a function.&lt;br&gt;
The &lt;code&gt;filter()&lt;/code&gt; the method does not execute the function for empty elements.&lt;br&gt;
The &lt;code&gt;filter()&lt;/code&gt; the method does not change the original array.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const users = [&lt;br&gt;
{firstName: "Joe", lastName: "Doe"},&lt;br&gt;
{firstName: "Alex", lastName: "Clay"},&lt;br&gt;
{firstName: "Opie", lastName: "Winston"},&lt;br&gt;
{firstName: "Wasten", lastName: "Doe"},&lt;br&gt;
]&lt;br&gt;
const newUser = users.filter(user =&amp;gt; user.firstName == "Opie")&lt;br&gt;
console.log(newUser)&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reverse in JavaScript
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;reverse()&lt;/code&gt; method reverses the order of the elements in an array.&lt;br&gt;
The &lt;code&gt;reverse()&lt;/code&gt; method overwrites the original array.&lt;/p&gt;

&lt;p&gt;`const array1 = ['one', 'two', 'three']; &lt;br&gt;
console.log('array1:', array1); //["one", "two", "three"] &lt;/p&gt;

&lt;p&gt;const reversed = array1.reverse(); &lt;br&gt;
console.log('reversed:', reversed); //["three", "two", "one"]&lt;br&gt;&lt;br&gt;
// Careful: reverse is destructive -- it changes the original array.&lt;br&gt;
 console.log('array1:', array1); //["three", "two", "one"]`&lt;/p&gt;

&lt;h2&gt;
  
  
  SORT in JavaScript
&lt;/h2&gt;

&lt;p&gt;The sort() method sorts an array alphabetically:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];&lt;br&gt;
fruits.sort();&lt;br&gt;
console.log(fruits)&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Before We End…
&lt;/h2&gt;

&lt;p&gt;I hope you’ve found this article insightful, and that it helps you understand JavaScript arrays more clearly. Please practice the examples multiple times to get a good grip on them.&lt;br&gt;
Thanks for reading&lt;/p&gt;

&lt;p&gt;Support me!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.buymeacoffee.com/kfahad" rel="noopener noreferrer"&gt;BUY ME A COFFEE&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>Top JavaScript Array Methods with Examples</title>
      <dc:creator>Fahad ahmad</dc:creator>
      <pubDate>Wed, 22 Dec 2021 12:16:00 +0000</pubDate>
      <link>https://dev.to/pdevfahad/top-javascript-array-methods-with-examples-19ea</link>
      <guid>https://dev.to/pdevfahad/top-javascript-array-methods-with-examples-19ea</guid>
      <description>&lt;p&gt;In programming, an array is a collection of elements or items. Arrays store data as elements and retrieve them back when you need them.&lt;br&gt;
The array data structure is widely used in all programming languages that support it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Did I Write this Article?
&lt;/h2&gt;

&lt;p&gt;There are many great articles on JavaScript arrays already available around the internet. So why did I write yet another article on the same subject? What’s the motivation?&lt;br&gt;
Well, over the years of interacting with my mentees, I realized that most beginners need a tutorial that covers arrays thoroughly from beginning to end with examples.&lt;br&gt;
So I decided to create such an article chock full of meaningful examples. If you are a beginner at JavaScript, I hope you’ll find it very helpful.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is an Array in JavaScript?
&lt;/h2&gt;

&lt;p&gt;A pair of square brackets [] represents an array in JavaScript. All the elements in the array are comma(,) separated.&lt;br&gt;
In JavaScript, arrays can be a collection of elements of any type. This means that you can create an array with elements of type String, Boolean, Number, Objects, and even other Arrays.&lt;br&gt;
Here is an example of an array with four elements: type Number, Boolean, String, and Object.&lt;br&gt;
&lt;code&gt;const mixedTypedArray = [100, true, 'freeCodeCamp', {}];&lt;/code&gt;&lt;br&gt;
The position of an element in the array is known as its index. In JavaScript, the array index starts with 0, and it increases by one with each element.&lt;br&gt;
So, for example, in the above array, the element 100 is at index 0, true is at &lt;code&gt;index 1&lt;/code&gt;, 'freeCodeCamp' is at &lt;code&gt;index 2&lt;/code&gt;, and so on.&lt;br&gt;
The number of elements in the array determines its length. For example, the length of the above array is four.&lt;br&gt;
Interestingly, JavaScript arrays are not of fixed length. You can change the length anytime by assigning a positive numeric value. We will learn more about that in a while.&lt;br&gt;
&lt;code&gt;How to Create an Array in JavaScript&lt;/code&gt;&lt;br&gt;
You can create an array in multiple ways in JavaScript. The most straightforward way is by assigning an array value to a variable.&lt;/p&gt;
&lt;h2&gt;
  
  
  Add Element in Array
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;unshift()&lt;/code&gt; the method adds a new element to an array (at the beginning), and "unshifts" older elements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = [“Orange”, “Apple”, “Mango”, “Banana”,];
fruits.unshift(“Lemon”);
console.log(fruits)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;push()&lt;/code&gt; the method adds a new element to an array (at the end):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = [“Orange”, “Apple”, “Mango”, “Banana”,];
fruits.push(“lemon”);
console.log(fruits);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Delete Element
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;shift()&lt;/code&gt; the method removes the first array element and "shifts" all other elements to a lower index.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = [“Banana”, “Orange”, “Apple”, “Mango”];
fruits.shift();
console.log(fruits)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;pop()&lt;/code&gt; the method removes the last element from 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;const fruits = [“Banana”, “Orange”, “Apple”, “Mango”];
fruits.pop();
console.log(fruits)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;slice()&lt;/code&gt; method slices out a piece of an array into a new array.&lt;br&gt;
This example slices out a part of an array starting from array element 1 (“Orange”):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = [“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”];
const citrus = fruits.slice(1);
console.log(fruits)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;slice()&lt;/code&gt; the method creates a new array. It does not remove any elements from the source array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Filter Elements
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;filter()&lt;/code&gt; the method creates a new array filled with elements that pass a test provided by a function.&lt;br&gt;
The &lt;code&gt;filter()&lt;/code&gt; the method does not execute the function for empty elements.&lt;br&gt;
The &lt;code&gt;filter()&lt;/code&gt; the method does not change the original array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const users = [
{firstName: "Joe", lastName: "Doe"},
{firstName: "Alex", lastName: "Clay"},
{firstName: "Opie", lastName: "Winston"},
{firstName: "Wasten", lastName: "Doe"},
]
const newUser = users.filter(user =&amp;gt; user.firstName == "Opie")
console.log(newUser)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reverse in JavaScript
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;reverse()&lt;/code&gt; method reverses the order of the elements in an array.&lt;br&gt;
The &lt;code&gt;reverse()&lt;/code&gt; method overwrites the original array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const array1 = ['one', 'two', 'three']; 
console.log('array1:', array1); //["one", "two", "three"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const reversed = array1.reverse(); 
console.log('reversed:', reversed); //["three", "two", "one"]  
// Careful: reverse is destructive -- it changes the original array.
 console.log('array1:', array1); //["three", "two", "one"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  SORT in JavaScript
&lt;/h2&gt;

&lt;p&gt;The sort() method sorts an array alphabetically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
console.log(fruits)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Before We End…
&lt;/h2&gt;

&lt;p&gt;I hope you’ve found this article insightful, and that it helps you understand JavaScript arrays more clearly. Please practice the examples multiple times to get a good grip on them.&lt;br&gt;
Thanks for reading&lt;/p&gt;

&lt;p&gt;Support me!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.buymeacoffee.com/kfahad" rel="noopener noreferrer"&gt;Get Coffee here&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>react</category>
    </item>
  </channel>
</rss>
