<?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: Zaryab Khalid</title>
    <description>The latest articles on DEV Community by Zaryab Khalid (@zaryabkhalid).</description>
    <link>https://dev.to/zaryabkhalid</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%2F947512%2Fab9d6004-3f9c-4fbe-aaf0-ec7085990f4f.jpeg</url>
      <title>DEV Community: Zaryab Khalid</title>
      <link>https://dev.to/zaryabkhalid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zaryabkhalid"/>
    <language>en</language>
    <item>
      <title>Difference between find() and filter() methods in Javascript ?</title>
      <dc:creator>Zaryab Khalid</dc:creator>
      <pubDate>Wed, 19 Oct 2022 11:20:46 +0000</pubDate>
      <link>https://dev.to/zaryabkhalid/difference-between-find-and-filter-methods-in-javascript--2bbj</link>
      <guid>https://dev.to/zaryabkhalid/difference-between-find-and-filter-methods-in-javascript--2bbj</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;find() Method&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to find the single item in the array. find() method return a single item that fulfill the condition which passes into the callback function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let array = ['apple','orange','WaterMelon','Melon']   

//apply find() method to the array

console.log(array.find((item) =&amp;gt; item=='apple'))
returns --&amp;gt; apple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;filter() Method&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This method is used to find the multiple items in the array. filter() method return all those items which fulfills the condition that passes into the callback function.This method return a new array without modifying 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;let array = [1,2,3,4,5,6,7,8,9]   
//apply filter() method to the array
console.log(array.filter((item) =&amp;gt; item &amp;gt;=4))`
returns --&amp;gt; new Array [4,5,6,7,8,9]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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