<?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: Desiree </title>
    <description>The latest articles on DEV Community by Desiree  (@desireecodes_40).</description>
    <link>https://dev.to/desireecodes_40</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%2F457095%2F07b6b3ab-e4bd-43c9-91a7-bfc9d63301b9.jpg</url>
      <title>DEV Community: Desiree </title>
      <link>https://dev.to/desireecodes_40</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/desireecodes_40"/>
    <language>en</language>
    <item>
      <title>Understanding Arrays in JavaScript...</title>
      <dc:creator>Desiree </dc:creator>
      <pubDate>Fri, 11 Sep 2020 17:25:04 +0000</pubDate>
      <link>https://dev.to/desireecodes_40/understanding-arrays-in-javascript-1aje</link>
      <guid>https://dev.to/desireecodes_40/understanding-arrays-in-javascript-1aje</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;What is an Array?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;We can use Arrays to organise data in JavaScript by making lists. Arrays can store any data types &lt;em&gt;(strings: "Hello!", integers: 5, booleans: false)&lt;/em&gt; and we can also use keywords &lt;em&gt;(let or const)&lt;/em&gt; to declare a variable and save it to an array.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;How does an Array work?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Arrays are represented by square brackets &lt;em&gt;[ ]&lt;/em&gt; and content inside &lt;em&gt;(elements)&lt;/em&gt;. Every element within an Array has a numbered position known as index. This means the positions start counting from 0 rather than 1. &lt;/p&gt;

&lt;p&gt;For example: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Below, I have created an array called &lt;em&gt;javaScript&lt;/em&gt;. &lt;em&gt;javaScript&lt;/em&gt; is an array that has 3 elements.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mLP3W6Nh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3kp5yfdsvdv2pqozon2b.PNG" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The first element within an array is always at position [0]. The second element is at position [1] and the third element is at position [2].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Logging javaScript[1] to the console will access the element at index 1. &lt;em&gt;// output: arrays&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Other cool things we can do...&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Did you know that we can also access individual characters in a string using bracket notations and the index?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For example:&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;let challenge = '100 days of Code';&lt;br&gt;
console.log(challenge[10]);&lt;br&gt;
//output: C&lt;/p&gt;

&lt;p&gt;Did you know that we can update elements within an array?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For example:&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AWg4KdlM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cm72zuf2r99kjo7rkzdi.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AWg4KdlM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cm72zuf2r99kjo7rkzdi.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another cool thing are Array methods: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;For example, we can use avengerCharacters.push('Black Panther') to push the element into the array, meaning adding 'Black Panther' to the list. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We can use avengerCharacters.pop('Iron Man') to pop the element out of the array, meaning removing 'Iron Man' from the list. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Array methods are a cool, quick and easy way to complete tasks. You can find more methods and explanations of each here: &lt;br&gt;
&lt;a href="https://www.w3schools.com/js/js_array_methods.asp#:%7E:text=%20JavaScript%20Array%20Methods%20%201%20Converting%20Arrays,delete%20may%20leave%20undefined%20holes%20in...%20More%20"&gt;https://www.w3schools.com/js/js_array_methods.asp#:~:text=%20JavaScript%20Array%20Methods%20%201%20Converting%20Arrays,delete%20may%20leave%20undefined%20holes%20in...%20More%20&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or here: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

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