<?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: Blessed T Mahuni</title>
    <description>The latest articles on DEV Community by Blessed T Mahuni (@blessedtawanda).</description>
    <link>https://dev.to/blessedtawanda</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%2F235779%2F9bd49853-8752-482b-b5c8-26fa3fddb2eb.png</url>
      <title>DEV Community: Blessed T Mahuni</title>
      <link>https://dev.to/blessedtawanda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/blessedtawanda"/>
    <language>en</language>
    <item>
      <title>How to add security to your MongoDB Docker Container</title>
      <dc:creator>Blessed T Mahuni</dc:creator>
      <pubDate>Wed, 20 Jul 2022 07:50:54 +0000</pubDate>
      <link>https://dev.to/blessedtawanda/how-to-add-security-to-your-mongodb-docker-container-4acc</link>
      <guid>https://dev.to/blessedtawanda/how-to-add-security-to-your-mongodb-docker-container-4acc</guid>
      <description>&lt;p&gt;All databases must be secure to prevent unauthorized access to your data. For &lt;a href="https://www.mongodb.com/atlas/database" rel="noopener noreferrer"&gt;Atlas&lt;/a&gt; users, it is very easy to set up security for your database since most of it is automated by Atlas and all you have to do is follow a setup wizard, it gets tricky when you are hosting your own instance of mongo using the power of docker so I'm going to walk you through the steps needed to host a secure MongoDB docker container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NB: This guide assumes you have some &lt;a href="https://www.docker.com" rel="noopener noreferrer"&gt;docker&lt;/a&gt; knowledge and you have docker setup in your work environment.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;So first things first we need to have the &lt;a href="https://hub.docker.com/_/mongo" rel="noopener noreferrer"&gt;MongoDB docker container&lt;/a&gt; up and running, this can be done with the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; some-mongo &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MONGO_INITDB_ROOT_USERNAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mongoadmin &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MONGO_INITDB_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;secret &lt;span class="se"&gt;\&lt;/span&gt;
    mongo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you look closely here we are creating an instance of the mongo image (container) with the environment variables &lt;strong&gt;MONGO_INITDB_ROOT_USERNAME&lt;/strong&gt;, &lt;strong&gt;MONGO_INITDB_ROOT_PASSWORD&lt;/strong&gt; Setting these two variables will create a database user, The user will be created in the &lt;strong&gt;&lt;em&gt;auth&lt;/em&gt;&lt;/strong&gt; authentication database and is given the role of &lt;strong&gt;&lt;em&gt;root&lt;/em&gt;&lt;/strong&gt; which is a super user in MongoDB.  Now that the MongoDB image is running with the name &lt;strong&gt;some-mongo&lt;/strong&gt; we need to login into the mongo shell and create users for our databases. Run the command below to run bash on the mongo container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker container &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; some-mongo bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the running terminal is bash now we need to run mongo and connect to our secure local database using the command below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mongo mongodb://mongoadmin:secret@localhost:27017
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything runs correctly you should be able to see a terminal almost similar to one below depending on your system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fgo0ir42v58xw7i2qc72u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fgo0ir42v58xw7i2qc72u.png" alt="Mongo Terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are running DB commands as root user we can create database users for ours databases. &lt;/p&gt;

&lt;p&gt;To create a user for the database &lt;strong&gt;customers&lt;/strong&gt; you run the following commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;use customers
db.createUser&lt;span class="o"&gt;({&lt;/span&gt;
    user: &lt;span class="s2"&gt;"web-app"&lt;/span&gt;,
    &lt;span class="nb"&gt;pwd&lt;/span&gt;: &lt;span class="s2"&gt;"eureka"&lt;/span&gt;,
    roles: &lt;span class="o"&gt;[{&lt;/span&gt;role: &lt;span class="s2"&gt;"readWrite"&lt;/span&gt;, db: &lt;span class="s2"&gt;"customers"&lt;/span&gt;&lt;span class="o"&gt;}]&lt;/span&gt;
&lt;span class="o"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the above commands the database customers will now be a secure DB with user &lt;strong&gt;web-app.&lt;/strong&gt; The database will now be accessible with the connection string &lt;strong&gt;&lt;code&gt;mongodb://web-app:eureka@&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;&lt;/code&gt; .&lt;/strong&gt; You can now use this connection string in your server configs or even in MongoDB Compass to browse the data.&lt;/p&gt;

&lt;p&gt;Yay now you have a secure database on your docker container 🙌👏🙌👏&lt;/p&gt;

</description>
      <category>docker</category>
      <category>mongodb</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>New NPM package I created</title>
      <dc:creator>Blessed T Mahuni</dc:creator>
      <pubDate>Sat, 06 Jun 2020 08:23:48 +0000</pubDate>
      <link>https://dev.to/blessedtawanda/new-npm-package-i-created-138m</link>
      <guid>https://dev.to/blessedtawanda/new-npm-package-i-created-138m</guid>
      <description>&lt;p&gt;I made a little something for react-native developers. A CLI tool for easy component generation. Its called &lt;a href="https://www.npmjs.com/package/gen-comp"&gt;gen-comp&lt;/a&gt;. This is my first NPM package please give me some suggestions for improvements. 😀&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>Important JavaScript Array Functions To Keep On Your Fingertips</title>
      <dc:creator>Blessed T Mahuni</dc:creator>
      <pubDate>Tue, 15 Oct 2019 19:12:28 +0000</pubDate>
      <link>https://dev.to/blessedtawanda/important-javascript-array-functions-to-keep-on-your-fingertips-6pj</link>
      <guid>https://dev.to/blessedtawanda/important-javascript-array-functions-to-keep-on-your-fingertips-6pj</guid>
      <description>&lt;p&gt;JavaScript has some amazing Array Functions that help you out in your day to day array handling especially if you are consuming data from an API that returns a list/array of items lets say you have an array of Members from your an API that manages members of lets say a club or maybe you just have an array of numbers you need to manipulate. examples below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;members&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Blessed Mahuni&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;memberType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gold&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Victoria Mahuni&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;memberType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gold&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;


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



&lt;h3&gt;
  
  
  The Array Functions we are going to talk about are
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;filter &lt;/li&gt;
&lt;li&gt;map&lt;/li&gt;
&lt;li&gt;find&lt;/li&gt;
&lt;li&gt;...(spread operator)&lt;/li&gt;
&lt;li&gt;join&lt;/li&gt;
&lt;li&gt;reverse&lt;/li&gt;
&lt;li&gt;push&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Push
&lt;/h4&gt;

&lt;p&gt;This one is simple to understand as the name says you are pushing data into your array in other words adding data at the end of the array example we need to update the list of our members in our members array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;member&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Moreblessing Mahuni&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;memberType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;silver&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;members&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;member&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// The member 'Moreblessing Mahuni' will now be in our members array&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Reverse
&lt;/h4&gt;

&lt;p&gt;This is another simple to understand and its functionality is as its name states. Reverse reverses the order of elements in an array. Lets say we have an array [1,2,3,4] and we use the reverse function the result array is [4,3,2,1]&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;67&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;67&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;reversedNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reversedNumbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [67,45,12,67,45,34]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  ...(spread operator)
&lt;/h4&gt;

&lt;p&gt;The spread operator is a very useful operator it is used where we need to operate on elements of an array individually. I normally use it when i want to create a clone of an array which does not reference to the same array object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbers1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;67&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;67&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbers2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numbers1&lt;/span&gt;

&lt;span class="cm"&gt;/*
numbers1 and numbers2 are references to the same object [34,45,67,45,67] 
so changes to number1 will affect numbers2 but usually we wouldn't want to do
this so the spread operator comes to the rescue
*/&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbers3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="nx"&gt;numbers3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;numbers1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;//changes to numbers3 will not affect numbers1&lt;/span&gt;

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



&lt;h3&gt;
  
  
  Filter
&lt;/h3&gt;

&lt;p&gt;The filter functions creates a new array with elements that fit a certain criteria i.e. filtered array. This is a very convenient function and most of the time it will come in handy. In our members array lets filter the members and get a members list of memberType 'gold'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;goldMembers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;members&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;member&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;member&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;memberType&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gold&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;member&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

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



&lt;p&gt;Here is what is going on the function iterates over all the members and the callback that you pass to the function will be applied on each element therefor in my case it will test if the memberType is equal to gold if it is equal to gold we return the member this returned value will be appended to the new array in this case goldMembers&lt;/p&gt;

&lt;h3&gt;
  
  
  Find
&lt;/h3&gt;

&lt;p&gt;The find function is useful if you are looking for a specific element in an array. The function will return the value of the first element that satisfies the the condition. The code will explain it better.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;silverMember&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;members&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;member&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;member&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;memberType&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;silver&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;member&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The code above will return the first element in the members array that has member type silver&lt;/p&gt;

&lt;h3&gt;
  
  
  Map
&lt;/h3&gt;

&lt;p&gt;Map creates a new array with element values that have been altered by a function that has been called on each element value. Lets explain with an example lets say you have an array [2,4,6,8] and you what to double the values in this array it would be perfect to use map with a one liner instead of looping through each and pushing to the new array. See code below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The Map Way&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;numbersToBeDoubled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;doubledNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numbersToBeDoubled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;//The Loop Through Way&lt;/span&gt;
&lt;span class="nx"&gt;numbersToBeDoubled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;doubledNumbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can see the map way is dope.&lt;/p&gt;

&lt;h3&gt;
  
  
  Join
&lt;/h3&gt;

&lt;p&gt;As the name says this function joins all the elements in an array and creates a string. The default separator is a comma but you can specify the separator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;joinedNums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// "1,2,3,4"&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;joinedNumsWithColon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// "1:2:3:4" specified joiner&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;At least this is the list of functions that i frequently use on arrays whats your add to the list and please put some sample code and explain&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to become a JavaScript Developer For Free</title>
      <dc:creator>Blessed T Mahuni</dc:creator>
      <pubDate>Sat, 12 Oct 2019 11:35:08 +0000</pubDate>
      <link>https://dev.to/blessedtawanda/how-to-become-a-javascript-developer-for-free-3p4k</link>
      <guid>https://dev.to/blessedtawanda/how-to-become-a-javascript-developer-for-free-3p4k</guid>
      <description>&lt;p&gt;Before getting into much detail if you really want to learn JavaScript for free check out &lt;a href="https://www.freecodecamp.org/"&gt;FreeCodeCamp&lt;/a&gt;, read throw this if you want some details on how to walk the path the easy way.&lt;/p&gt;

&lt;p&gt;Since I wrote the article “Why Learn JavaScript?” It has become inevitable for me to write how to become a JavaScript developer. I am a proud Full stack JavaScript Developer but there are some mistakes that I made in my journey in becoming a JavaScript developer and I don’t want you to repeat the same mistakes that I did.&lt;/p&gt;

&lt;p&gt;First things first a little history lesson about JavaScript. JavaScript was created in 1995 in 10 days (amazing right) by Brendan Eich at Netscape Communication Corporation for Netscape Navigator a web browser, so generally, JavaScript was developed/created for the browser. Initially, it wasn’t called JavaScript it was called Mocha, then the name was changed to LiveScript and for some reason, it was named JavaScript.&lt;/p&gt;

&lt;p&gt;In 1996 JavaScript was standardized by a body called European Computer Manufacturers Association (E.C.M.A.) and the language was handed over to this body and to date they are the ones who maintain and standardize it. When it was handed to E.C.M.A. JavaScript was renamed to ECMAScript but people still call it JavaScript I think because it's catchy. I'm going to stop here you can learn more about JavaScript History sorry I mean ECMAScript &lt;a href="https://www.checkmarx.com/blog/javascript-history-infographic/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As you can see from the history JavaScript was meant for the browser i.e. web i.e. internet, so you have to become a web developer to some extent and being a JavaScript developer means you are a web developer. A good starting place to get to know all your web development is &lt;a href="https://www.freecodecamp.org/"&gt;FreeCodeCamp&lt;/a&gt;, it is a totally free learning platform and it is very comprehensive. The main advantage of FreeCodeCamp is that you will be certified after completing projects for a specific section of learning.&lt;/p&gt;

&lt;p&gt;So now you started your FreeCodeCamp courses and you know a little JavaScript you are certified or not yet but you know JavaScript at this point I urge you to go by &lt;a href="https://javascript30.com/"&gt;JavaScript 30&lt;/a&gt; by &lt;a href="https://wesbos.com/"&gt;Wes Bos&lt;/a&gt; . It is a 30 projects in 30 days challenge created for beginner, intermediate and expert JavaScript developers so that they can sharpen their knowledge and become more skilled by immediately implementing what they just learned.&lt;/p&gt;

&lt;p&gt;After JavaScript 30 and freecodecamp, you would be familiar and good with your JavaScript so it would be appropriate to start learning some JavaScript frontend frameworks and there are a lot out there just google Javascript Frameworks and see for yourself. Depending on what you want, you can choose to learn just one framework or two or more depending on your capacity but I suggest learning two and really grasp how they work because with two you will be able to choose a tool stack depending on project requirements. In the industry, React is very popular if you go through freeCodeCamp you will be taught this framework. The other popular framework in the industry is Angular this is also one of the best frameworks. So if you are to learn two best frameworks I recommend these two because they are widely used in the industry but I strongly recommend starting to learn React because of its linear learning curve its not as steep as Angular because in Angular there something called &lt;a href="http://www.typescriptlang.org/"&gt;TypeScript&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Besides &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt; and &lt;a href="https://angular.io/"&gt;Angular&lt;/a&gt;, there is another framework that you should consider if you like simple stuff and that &lt;a href="https://vuejs.org/"&gt;VueJs&lt;/a&gt;. VueJs is like a mirror image/child of React because almost every concept in React is available in VueJs and is usually simpler to understand. These two frameworks React and VueJs complement each other so learning the two will help you understand one or the other framework this is a personal observation.&lt;/p&gt;

&lt;p&gt;If you follow this path in your journey of becoming a JavaScript developer, you would now be a frontend javascript developer. Now you should know that a web application can not run with just frontend especially if you need to store and process data, for that you need backend.&lt;/p&gt;

&lt;p&gt;The Backend: This is where your data is stored, processed and given back to the frontend for it to be displayed to the user. The backend runs on a server and frontend runs on the client i.e. browser.&lt;/p&gt;

&lt;p&gt;For your backend you need to learn NodeJs, server-side javascript I would go deeper with this but this is a topic on its own. NodeJs is also taught on freecodecamp that’s why I said its comprehensive.&lt;/p&gt;

&lt;p&gt;When you now know your NodeJs, React/Vue/Angular you can proudly call yourself a Fullstack Developer. The journey is long my best advice is to brace yourself and be persistent.&lt;/p&gt;

&lt;h5&gt;
  
  
  Here if a list of resources for your free learning
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/"&gt;FreeCodeCamp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://javascript30.com/"&gt;JavaScript30&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/user/TechGuyWeb/"&gt;TravesyMedia&lt;/a&gt; (free YouTube tutotrials)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg"&gt;The Net Ninja&lt;/a&gt; (free youtube tutorials and there is also premium content)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Token of appreciation</title>
      <dc:creator>Blessed T Mahuni</dc:creator>
      <pubDate>Sat, 12 Oct 2019 05:13:35 +0000</pubDate>
      <link>https://dev.to/blessedtawanda/token-of-appreciation-2b92</link>
      <guid>https://dev.to/blessedtawanda/token-of-appreciation-2b92</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wZ48KSTL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/amacije27g6i8le8gczh.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wZ48KSTL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/amacije27g6i8le8gczh.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Thank you DEV community you are inspiring me to write more posts might drop 2 more today
&lt;/h4&gt;

</description>
    </item>
    <item>
      <title>Why Learn Javascript</title>
      <dc:creator>Blessed T Mahuni</dc:creator>
      <pubDate>Wed, 09 Oct 2019 08:45:41 +0000</pubDate>
      <link>https://dev.to/blessedtawanda/why-learn-javascript-ka1</link>
      <guid>https://dev.to/blessedtawanda/why-learn-javascript-ka1</guid>
      <description>&lt;p&gt;JavaScript has clearly become one of the most popular languages in the 21st century ever since the introduction of the server-side JavaScript &lt;a href="https://nodejs.org/en/"&gt;NodeJs&lt;/a&gt;. A lot of frontend frameworks have popped up which means you can become a full-stack developer with one language and of course, you need a bit of HTML5 and CSS3 skills to sexy up your frontend.&lt;/p&gt;

&lt;p&gt;Being a JavaScript developer doesn’t mean you are just a web developer you can also become a cross-platform mobile web application developer with the help of frameworks like &lt;a href="https://facebook.github.io/react-native/"&gt;react-native&lt;/a&gt; , &lt;a href="https://ionicframework.com/"&gt;ionic&lt;/a&gt; to mention but a few. You can also do some machine learning and implement some machine learning models using &lt;a href="https://www.tensorflow.org/js"&gt;TensorFlow.js&lt;/a&gt; this means your web applications will be smarter using just JavaScript.&lt;/p&gt;

&lt;p&gt;Game development is also now possible with JavaScript using frameworks like &lt;a href="https://p5js.org/"&gt;p5.js&lt;/a&gt; there are some &lt;a href="https://www.youtube.com/redirect?redir_token=y6mR6od3kaBawCMu66lyr90G2yN8MTU2ODU3NjE5NkAxNTY4NDg5Nzk2&amp;amp;event=video_description&amp;amp;v=AaGK-fj-BAM&amp;amp;q=http%3A%2F%2Fthecodingtrain.com%2FCodingChallenges%2F003-snake-game-p5.html"&gt;YouTube Videos&lt;/a&gt; with examples for this.&lt;/p&gt;

&lt;p&gt;The JavaScript ecosystem and community has become one of the biggest programming communities on the internet. This is because of its popularity and the node package manager (&lt;a href="https://www.npmjs.com/"&gt;npm&lt;/a&gt;). The package manager accesses over a million repositories of open source code packages that mostly simplify your development process. If you want to manipulate time and dates there is &lt;a href="https://momentjs.com/"&gt;momentjs&lt;/a&gt;, if you want to hash your passwords and secrets for security and authentication there &lt;a href="https://www.npmjs.com/package/bcryptjs"&gt;bcryptjs&lt;/a&gt;, if you want a series of utility functions to help manipulate strings, arrays, objects and many more there is &lt;a href="https://lodash.com/"&gt;lodash&lt;/a&gt;. Long story short with npm there is no need to rewrite code if common fixes there is a high probability that there is a npm package that does exactly the same so you just have to utilize it.&lt;/p&gt;

&lt;p&gt;In conclusion, JavaScript is a language just like any other mainstream language out there it is no longer bound to the browser like the old days so I would recommend it as a starting point if you are new to development and programming. To get started take the JavaScript Algorithms and Data Structures course from &lt;a href="https://freecodecamp.org/"&gt;FreeCodeCamp&lt;/a&gt;. If you haven’t written any JavaScript and you are now a good developer with some other language I recommend you get started with a few JavaScript.&lt;/p&gt;

&lt;p&gt;These three are popular JavaScript front frameworks to look into and I have personally tried them&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;Vue&lt;/li&gt;
&lt;li&gt;Angular (TypeScript Involved Another Story)&lt;/li&gt;
&lt;/ul&gt;

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