<?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: Tsito Ranjafy</title>
    <description>The latest articles on Forem by Tsito Ranjafy (@tsitohaina).</description>
    <link>https://forem.com/tsitohaina</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%2F1647438%2Fce875146-4cec-4375-aa19-1004feaa195c.jpeg</url>
      <title>Forem: Tsito Ranjafy</title>
      <link>https://forem.com/tsitohaina</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tsitohaina"/>
    <language>en</language>
    <item>
      <title>Select Element in Array() to a new Array() JavaScript</title>
      <dc:creator>Tsito Ranjafy</dc:creator>
      <pubDate>Wed, 19 Jun 2024 16:44:09 +0000</pubDate>
      <link>https://forem.com/tsitohaina/select-element-in-array-to-a-new-array-javascript-2805</link>
      <guid>https://forem.com/tsitohaina/select-element-in-array-to-a-new-array-javascript-2805</guid>
      <description>&lt;p&gt;JavaScript Array slice()&lt;br&gt;
Select 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 = ["Banana","Orange","Lemon","Apple","Mango"];
const citrus = fruits.slice(1, 3);
console.log(citrus);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F107qll9ct30aod2yqcu2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F107qll9ct30aod2yqcu2.jpg" width="800" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select elements using negative values:&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 myBest = fruits.slice(-3, -1);
console.log(myBest);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8r77g93xynsen96emenx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8r77g93xynsen96emenx.jpg" width="800" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The slice() method returns selected elements in an array, as a new array.&lt;/p&gt;

&lt;p&gt;The slice() method selects from a given start, up to a (not inclusive) given end.&lt;/p&gt;

&lt;p&gt;The slice() method does not change the original array.&lt;/p&gt;

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