<?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: Mishael Dada</title>
    <description>The latest articles on DEV Community by Mishael Dada (@mishaeldada).</description>
    <link>https://dev.to/mishaeldada</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%2F687514%2Fe19b0fdd-db74-4426-90c4-b3125edf58b2.jpg</url>
      <title>DEV Community: Mishael Dada</title>
      <link>https://dev.to/mishaeldada</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mishaeldada"/>
    <language>en</language>
    <item>
      <title>Everything You Need To Know About ARRAYS</title>
      <dc:creator>Mishael Dada</dc:creator>
      <pubDate>Sat, 23 Jul 2022 15:17:29 +0000</pubDate>
      <link>https://dev.to/mishaeldada/everything-you-need-to-know-about-arrays-302f</link>
      <guid>https://dev.to/mishaeldada/everything-you-need-to-know-about-arrays-302f</guid>
      <description>&lt;h2&gt;
  
  
  INTRODUCTION
&lt;/h2&gt;

&lt;p&gt;The array is the most common data structure in computer programming. Every programming language includes some form of array. Arrays are commonly used in computer programs to &lt;strong&gt;organize data&lt;/strong&gt; so that a &lt;strong&gt;related set of values&lt;/strong&gt; can be easily sorted or searched.&lt;/p&gt;

&lt;p&gt;So for most of my code snippet I will be using the JavaScript language which I am most comfortable with but, I'll also make sure to write the code so that other programmers from other languages can understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  DEFINITION OF AN ARRAY
&lt;/h2&gt;

&lt;p&gt;An array is a &lt;strong&gt;data structure&lt;/strong&gt; that contains a group of elements. Typically, these elements are all the same data type, such as an integer or string.&lt;/p&gt;

&lt;p&gt;For example, imagine that a score table in a game needs to record ten scores. One way to do this is to have a variable for each score:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;score_0
score_1
score_2
score_3
score_4
score_5
score_6
score_7
score_8
score_9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would work, but there is a better way. It is much simpler to keep all the related data under one name. We do this by using an array.&lt;br&gt;
Instead of having ten variables, each holding a score, there could be one array that holds all the related data:&lt;br&gt;
score(9)&lt;/p&gt;

&lt;p&gt;Well, you might be wondering why score(9)? When we have 10 scores, that is because arrays are zero-indexed; that is - when elements are stored in an array, an index/key is assigned to each element of the array to enable us to access or mutate this element in the future.&lt;/p&gt;

&lt;p&gt;Here's an illustration:&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1657850800573%2Fsqr0d0Ggc.png%2520align%3D" 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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1657850800573%2Fsqr0d0Ggc.png%2520align%3D" alt="array.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It helps to think of an array as a row of cells, like the ones found in a table. Each cell represents an element. The individual values, or array elements, are numbered 0 to 9 because arrays start counting at 0.&lt;/p&gt;

&lt;p&gt;In another example, a search engine may use an array to store Web pages found in a search performed by the user. When displaying the results, the program will output one element of the array at a time. This may be done for a specified number of values or until all the values stored in the array have been output. While the program could create a new variable for each result found, storing the results in an array is a much more efficient way to manage memory.&lt;/p&gt;

&lt;p&gt;The syntax for storing and displaying the values in an array typically looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arrayname[0] = "This ";
arrayname[1] = "is ";
arrayname[2] = "pretty simple.";
&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;console.log(arrayname[0]);
console.log(arrayname[1]);
console.log(arrayname[2]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above commands would print the first three values of the array, or &lt;strong&gt;"This is pretty simple."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By using a &lt;strong&gt;"while"&lt;/strong&gt; or &lt;strong&gt;"for"&lt;/strong&gt; loop, the programmer can tell the program to output each value in the array until the last value has been reached. So not only do arrays help manage memory more efficiently, they make the programmer's job more efficient as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  USING ARRAYS
&lt;/h2&gt;

&lt;p&gt;There are several ways to create arrays, access array elements, and perform tasks such as searching and sorting the elements stored in an array. In this section, we'll discuss several array methods and properties.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating an Array
&lt;/h3&gt;

&lt;p&gt;The simplest way to create an array is by declaring an array variable using the [] operator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = [];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you create an array in this manner, you have an array with length of 0. You can verify this by calling the built-in length property:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(numbers.length); // displays 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another way to create an array is to declare an array variable with a set of elements inside the [] operator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = [1,2,3,4,5];
console.log(numbers.length); // displays 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also create an array by calling the &lt;strong&gt;Array constructor&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = new Array();
console.log(numbers.length); // displays 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can call the Array constructor with a set of elements as arguments to the constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = new Array(1,2,3,4,5);
console.log(numbers.length); // displays 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, you can create an array by calling the Array constructor with a single argument specifying the length of the array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = new Array(10);
console.log(numbers.length); // displays 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike many other programming languages, but common for most scripting languages,&lt;br&gt;
JavaScript array elements do not all have to be of the same type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var objects = [1, "Joe", true, null];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can verify that an object is an array by calling the Array.isArray() function, like&lt;br&gt;
this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = 3;
var arr = [7,4,1776];
console.log(Array.isArray(number)); // displays false
console.log(Array.isArray(arr)); // displays true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We’ve covered several techniques for creating arrays. As for which function is best, most JavaScript's experts recommend using the [] operator, saying it is more efficient than calling the Array constructor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Accessing and Writing Array Elements
&lt;/h3&gt;

&lt;p&gt;Data is assigned to array elements using the [] operator in an assignment statement.&lt;br&gt;
For example, the following loop assigns the values 1 through 100 to 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;var nums = [];
for (var i = 0; i &amp;lt; 100; ++i) {
  nums[i] = i + 1;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Array elements are also accessed using the [] operator. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = [1,2,3,4,5];
var sum = numbers[0] + numbers[1] + numbers[2] + numbers[3] +
numbers[4];
console.log(sum); // displays 15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, accessing all the elements of an array &lt;strong&gt;sequentially&lt;/strong&gt; is much easier using a for&lt;br&gt;
loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var numbers = [1, 2, 3, 5, 8, 13, 21];
var sum = 0;
for (var i = 0; i &amp;lt; numbers.length; ++i) {
  sum += numbers[i];
}
console.log(sum); // displays 53
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that the for loop is controlled using the length property rather than an integer literal. Because JavaScript arrays are objects, they can grow beyond the size specified when they were created. By using the length property, which returns the number of elements currently in the array, you can guarantee that your loop processes all array elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating Arrays from Strings
&lt;/h3&gt;

&lt;h4&gt;
  
  
  (Split method)
&lt;/h4&gt;

&lt;p&gt;Arrays can be created as the result of calling the split() function on a string. This&lt;br&gt;
function breaks up a string at a common delimiter, such as a space for each word, and&lt;br&gt;
creates an array consisting of the individual parts of the string.&lt;/p&gt;

&lt;p&gt;The following short program demonstrates how the split() function works on a simple&lt;br&gt;
string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var sentence = "the quick brown fox jumped over the lazy dog";
var words = sentence.split(" ");
for (var i = 0; i &amp;lt; words.length; ++i) {
  console.log("word " + i + ": " + words[i]);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output from this program is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;word 0: the
word 1: quick
word 2: brown
word 3: fox
word 4: jumped
word 5: over
word 6: the
word 7: lazy
word 8: dog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  (Array.from() method)
&lt;/h4&gt;

&lt;p&gt;The Array.from() function is an inbuilt function in JavaScript which creates a new array instance from a given array. In case of a string, every alphabet of the string is converted to an element of the new array instance and in case of integer values, the new array instance simple take the elements of the given array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var sentence = "the quick brown fox jumped over the lazy dog";
var words = Array.from(sentence);
console.log(words)
&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;[
  't', 'h', 'e', ' ', 'q', 'u', 'i',
  'c', 'k', ' ', 'b', 'r', 'o', 'w',
  'n', ' ', 'f', 'o', 'x', ' ', 'j',
  'u', 'm', 'p', 'e', 'd', ' ', 'o',
  'v', 'e', 'r', ' ', 't', 'h', 'e',
  ' ', 'l', 'a', 'z', 'y', ' ', 'd',
  'o', 'g'
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Aggregate Array Operations
&lt;/h3&gt;

&lt;p&gt;There are several aggregate operations you can perform on arrays. First, you can assign one array to another array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [];
for (var i = 0; i &amp;lt; 10; ++i) {
  nums[i] = i+1;
}
var samenums = nums;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, when you assign one array to another array, you are assigning a reference to the assigned array. When you make a change to the original array, that change is reflected in the other array as well. The following code fragment demonstrates how this works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [];
for (var i = 0; i &amp;lt; 100; ++i) {
  nums[i] = i+1;
}
var samenums = nums;
nums[0] = 400;
console.log(samenums[0]); // displays 400
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is called a shallow copy. The new array simply points to the original array’s elements. A better alternative is to make a deep copy, so that each of the original array’s elements is actually copied to the new array’s elements. An effective way to do this is to create a function to perform the task:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function copy(arr1, arr2) {
  for (var i = 0; i &amp;lt; arr1.length; ++i) {
    arr2[i] = arr1[i];
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the following code fragment produces the expected result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [];
for (var i = 0; i &amp;lt; 100; ++i) {
  nums[i] = i+1;
}
var samenums = [];
copy(nums, samenums);
nums[0] = 400;
console.log(samenums[0]); // displays 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Accessor Functions
&lt;/h2&gt;

&lt;p&gt;JavaScript provides a set of functions you can use to access the elements of an array. These functions, called accessor functions, return some representation of the target array as their return values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Searching for a Value
&lt;/h3&gt;

&lt;p&gt;One of the most commonly used accessor functions is &lt;strong&gt;indexOf()&lt;/strong&gt;, which looks to see if the argument passed to the function is found in the array. If the argument is contained in the array, the function returns the index position of the argument. If the argument is not found in the array, the function returns -1. Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var names = ["David", "Cynthia", "Raymond", "Clayton", "Jennifer"];
putstr("Enter a name to search for: ");
var name = readline();
var position = names.indexOf(name);
if (position &amp;gt;= 0) {
  console.log("Found " + name + " at position " + position);
}
else {
  console.log(name + " not found in array.");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run this program and enter Cynthia, the program will output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Found Cynthia at position 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you enter Joe, the output is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Joe not found in array.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have multiple occurrences of the same data in an array, the indexOf() function will always return the position of the first occurrence. A similar function, &lt;strong&gt;lastIndexOf()&lt;/strong&gt;, will return the position of the last occurrence of the argument in the array, or -1&lt;br&gt;
if the argument isn’t found.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var names = ["David", "Mike", "Cynthia", "Raymond", "Clayton", "Mike", "Jennifer"];
var name = "Mike";
var firstPos = names.indexOf(name);
console.log("First found " + name + " at position " + firstPos);
var lastPos = names.lastIndexOf(name);
console.log("Last found " + name + " at position " + lastPos);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output from this program is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;First found Mike at position 1
Last found Mike at position 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  String Representations of Arrays
&lt;/h3&gt;

&lt;p&gt;There are two functions that return string representations of an array: &lt;strong&gt;join()&lt;/strong&gt; and &lt;strong&gt;toString()&lt;/strong&gt;. Both functions return a string containing the elements of the array delimited by commas.&lt;/p&gt;

&lt;p&gt;Here are some examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var names = ["David", "Cynthia", "Raymond", "Clayton", "Mike", "Jennifer"];
var namestr = names.join();
console.log(namestr); // David,Cynthia,Raymond,Clayton,Mike,Jennifer
namestr = names.toString();
console.log(namestr); // David,Cynthia,Raymond,Clayton,Mike,Jennifer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating New Arrays from Existing Arrays
&lt;/h3&gt;

&lt;p&gt;There are two accessor functions that allow you create new arrays from existing arrays: &lt;strong&gt;concat()&lt;/strong&gt; and &lt;strong&gt;splice()&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The concat() function allows you to put together two or more arrays to create a new array, and the splice() function allows you to create a new array from a subset of an existing array.&lt;br&gt;
Let’s look first at how concat() works. The function is called from an existing array, and its argument is another existing array. The argument is concatenated to the end of the array calling concat(). The following program demonstrates how concat() works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var cisDept = ["Mike", "Clayton", "Terrill", "Danny", "Jennifer"];
var dmpDept = ["Raymond", "Cynthia", "Bryan"];
var itDiv = cis.concat(dmp);
console.log(itDiv);
itDiv = dmp.concat(cisDept);
console.log(itDiv);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The program outputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mike,Clayton,Terrill,Danny,Jennifer,Raymond,Cynthia,Bryan
Raymond,Cynthia,Bryan,Mike,Clayton,Terrill,Danny,Jennifer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first output line shows the data from the cis array first, and the second output line shows the data from the dmp array first.&lt;/p&gt;

&lt;p&gt;The splice() function creates a new array from the contents of an existing array. The arguments to the function are the starting position for taking the splice and the number of elements to take from the existing array. &lt;/p&gt;

&lt;p&gt;Here is how the method works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var itDiv = ["Mike","Clayton","Terrill","Raymond","Cynthia","Danny","Jennifer"];
var dmpDept = itDiv.splice(3,3);
var cisDept = itDiv;
console.log(dmpDept); // Raymond,Cynthia,Danny
console.log(cisDept); // Mike,Clayton,Terrill,Jennifer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are other uses for splice() as well, such as modifying an array by adding and/or removing elements. See the &lt;a href="http://mzl.la/1gmmlQ5" rel="noopener noreferrer"&gt;Mozilla Developer Network website&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mutator Functions
&lt;/h2&gt;

&lt;p&gt;JavaScript has a set of mutator functions that allow you to modify the contents of an array without referencing the individual elements. These functions often make hard techniques easy, as you’ll see below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Elements to an Array
&lt;/h3&gt;

&lt;p&gt;There are two mutator functions for adding elements to an array: &lt;strong&gt;push()&lt;/strong&gt; and &lt;strong&gt;unshift()&lt;/strong&gt;. The push() function adds an element to the end of 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;var nums = [1,2,3,4,5];
console.log(nums); // 1,2,3,4,5
nums.push(6);
console.log(nums); // 1,2,3,4,5,6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using push() is more intuitive than using the length property to extend 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;var nums = [1,2,3,4,5];
console.log(nums); // 1,2,3,4,5
nums[nums.length] = 6;
console.log(nums); // 1,2,3,4,5,6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adding data to the beginning of an array is much harder than adding data to the end of an array. To do so without the benefit of a mutator function, each existing element of the array has to be shifted up one position before the new data is added. Here is some code to illustrate this scenario:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [2,3,4,5];
var newnum = 1;
var N = nums.length;
for (var i = N; i &amp;gt;= 0; --i) {
  nums[i] = nums[i-1];
}
nums[0] = newnum;
console.log(nums); // 1,2,3,4,5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code becomes more inefficient as the number of elements stored in the array increases. The mutator function for adding array elements to the beginning of an array is unshift(). Here is how the function works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [2,3,4,5];
console.log(nums); // 2,3,4,5
var newnum = 1;
nums.unshift(newnum);
console.log(nums); // 1,2,3,4,5
nums = [3,4,5];
nums.unshift(1,2);
console.log(nums); // 1,2,3,4,5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second call to unshift() demonstrates that you can add multiple elements to an array with one call to the function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Removing Elements from an Array
&lt;/h3&gt;

&lt;p&gt;Removing an element from the end of an array is easy using the &lt;strong&gt;pop()&lt;/strong&gt; mutator function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [1,2,3,4,5,9];
nums.pop();
console.log(nums); // 1,2,3,4,5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without mutator functions, removing elements from the beginning of an array requires shifting elements toward the beginning of the array, causing the same inefficiency we see when adding elements to the beginning of 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;var nums = [9,1,2,3,4,5];
console.log(nums);
for (var i = 0; i &amp;lt; nums.length; ++i) {
  nums[i] = nums[i+1];
}
console.log(nums); // 1,2,3,4,5,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Besides the fact that we have to shift the elements down to collapse the array, we are also left with an extra element. We know this because of the extra comma we see when we display the array contents.&lt;/p&gt;

&lt;p&gt;The mutator function we need to remove an element from the beginning of an array is &lt;strong&gt;shift()&lt;/strong&gt;. Here is how the function works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [9,1,2,3,4,5];
nums.shift();
console.log(nums); // 1,2,3,4,5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll notice there are no extra elements left at the end of the array. Both pop() and shift() return the values they remove, so you can collect the values in a variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [6,1,2,3,4,5];
var first = nums.shift(); // first gets the value 9
nums.push(first);
console.log(nums); // 1,2,3,4,5,6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adding and Removing Elements from the Middle of an Array
&lt;/h3&gt;

&lt;p&gt;Trying to add or remove elements at the end of an array leads to the same problems we find when trying to add or remove elements from the beginning of an array—both operations require shifting array elements either toward the beginning or toward the end of the array. However, there is one mutator function we can use to perform both operations—&lt;strong&gt;splice()&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To add elements to an array using splice(), you have to provide the following arguments:&lt;/p&gt;

&lt;p&gt;• The &lt;strong&gt;starting index&lt;/strong&gt; (where you want to begin adding elements)&lt;/p&gt;

&lt;p&gt;• The &lt;strong&gt;number of elements to remove&lt;/strong&gt; (0 when you are adding elements)&lt;/p&gt;

&lt;p&gt;• The &lt;strong&gt;elements you want to add&lt;/strong&gt; to the array&lt;/p&gt;

&lt;p&gt;Let’s look at a simple example. The following program adds elements to the middle of 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;var nums = [1,2,3,7,8,9];
var newElements = [4,5,6];
nums.splice(3,0,newElements);
console.log(nums); // 1,2,3,4,5,6,7,8,9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The elements spliced into an array can be any list of items passed to the function, not necessarily a named array of items. &lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [1,2,3,7,8,9];
nums.splice(3,0,4,5,6);
console.log(nums);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the preceding example, the arguments 4, 5, and 6 represent the list of elements we want to insert into nums.&lt;br&gt;
Here is an example of using splice() to remove elements 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;var nums = [1,2,3,100,200,300,400,4,5];
nums.splice(3,4);
console.log(nums); // 1,2,3,4,5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Putting Array Elements in Order
&lt;/h3&gt;

&lt;p&gt;The last two mutator functions are used to arrange array elements into some type of order. The first of these, &lt;strong&gt;reverse()&lt;/strong&gt;, reverses the order of the elements of an array.&lt;/p&gt;

&lt;p&gt;Here is an example of its use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [1,2,3,4,5];
nums.reverse();
console.log(nums); // 5,4,3,2,1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We often need to sort the elements of an array into order. The mutator function for this task, &lt;strong&gt;sort()&lt;/strong&gt;, works very well with strings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var names = ["David","Mike","Cynthia","Clayton","Bryan","Raymond"];
nums.sort();
console.log(nums); // Bryan,Clayton,Cynthia,David,Mike,Raymond
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But sort() does not work so well with numbers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [3,1,2,100,4,200];
nums.sort();
console.log(nums); // 1,100,2,200,3,4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sort() function sorts data lexicographically, assuming the data elements are strings, even though in the preceding example, the elements are numbers. We can make the sort() function work correctly for numbers by passing in an ordering function as the first argument to the function, which sort() will then use to sort the array elements. This is the function that sort() will use when comparing pairs of array elements to determine their correct order.&lt;/p&gt;

&lt;p&gt;For numbers, the ordering function can simply subtract one number from another number. If the number returned is negative, the left operand is less than the right operand; if the number returned is zero, the left operand is equal to the right operand; and if the number returned is positive, the left operand is greater than the right operand. &lt;/p&gt;

&lt;p&gt;With this in mind, let’s rerun the previous small program using an ordering function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function compare(num1, num2) {
  return num1 - num2;
}
var nums = [3,1,2,100,4,200];
nums.sort(compare);
console.log(nums); // 1,2,3,4,100,200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The sort() function uses the compare() function to sort the array elements numerically rather than lexicographically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Iterator Functions
&lt;/h2&gt;

&lt;p&gt;The final set of array functions we examine areiterator functions. These functions apply a function to each element of an array, either returning a value, a set of values, or a new array after applying the function to each element of an array.&lt;/p&gt;

&lt;h3&gt;
  
  
  Non–Array-Generating Iterator Functions
&lt;/h3&gt;

&lt;p&gt;The first group of iterator functions we’ll discuss do not generate a new array; instead, they either perform an operation on each element of an array or generate a single value from an array. The first of these functions is &lt;strong&gt;forEach()&lt;/strong&gt;. This function takes a function as an argument and applies the called function to each element of an array.&lt;/p&gt;

&lt;p&gt;Here is an example of how it works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function square(num) {
  console.log(num, num * num);
}
var nums = [1,2,3,4,5,6,7,8,9,10];
nums.forEach(square);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output from this program is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 1
2 4
3 9
4 16
5 25
6 36
7 49
8 64
9 81
10 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next iterator function,** every()**, applies a Boolean function to an array and returns true if the function can return true for every element in the array.&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isEven(num) {
  return num % 2 == 0;
}
var nums = [2,4,6,8,10];
var even = nums.every(isEven);
if (even) {
  console.log("all numbers are even");
}
else {
  console.log("not all numbers are even");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The program displays:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;all numbers are even
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we change the array to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var nums = [2,4,6,7,8,10];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the program displays:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;not all numbers are even
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;some()&lt;/strong&gt; function will take a Boolean function and return true if at least one of the elements in the array meets the criterion of the Boolean function.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isEven(num) {
  return num % 2 == 0;
}
var nums = [1,2,3,4,5,6,7,8,9,10];
var someEven = nums.some(isEven);
if (someEven) {
  console.log("some numbers are even");
}
else {
  console.log("no numbers are even");
}
nums = [1,3,5,7,9];
someEven = nums.some(isEven);
if (someEven) {
  console.log("some numbers are even");
}
else {
  console.log("no numbers are even");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output from this program is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;some numbers are even
no numbers are even
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;reduce()&lt;/strong&gt; function applies a function to an accumulator and the successive elements of an array until the end of the array is reached, yielding a single value. Here is an example of using reduce() to compute the sum of the elements of 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;function add(runningTotal, currentValue) {
  return runningTotal + currentValue;
}
var nums = [1,2,3,4,5,6,7,8,9,10];
var sum = nums.reduce(add);
console.log(sum); // displays 55
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reduce() function, in conjunction with theadd() function, works from left to right,&lt;br&gt;
computing a running sum of the array elements, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add(1,2) -&amp;gt; 3
add(3,3) -&amp;gt; 6
add(6,4) -&amp;gt; 10
add(10,5) -&amp;gt; 15
add(15,6) -&amp;gt; 21
add(21,7) -&amp;gt; 28
add(28,8) -&amp;gt; 36
add(36,9) -&amp;gt; 45
add(45,10) -&amp;gt; 55
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also use reduce() with strings to perform concatenation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function concat(accumulatedString, item) {
  return accumulatedString + item;
}
var words = ["the ", "quick ","brown ", "fox "];
var sentence = words.reduce(concat);
console.log(sentence); // displays "the quick brown fox"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript also provides a &lt;strong&gt;reduceRight()&lt;/strong&gt; function, which works similarly to reduce(), only working from the righthand side of the array to the left, instead of from left to right. The following program uses reduceRight() to reverse the elements of 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;function concat(accumulatedString, item) {
  return accumulatedString + item;
}
var words = ["the ", "quick ","brown ", "fox "];
var sentence = words.reduceRight(concat);
console.log(sentence); // displays "fox brown quick the"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Iterator Functions That Return a New Array
&lt;/h3&gt;

&lt;p&gt;There are two iterator functions that return new arrays: &lt;strong&gt;map()&lt;/strong&gt; and &lt;strong&gt;filter()&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The map() function works like the forEach() function, applying a function to each element of an array. The difference between the two functions is that map() returns a new array with the results of the function application. &lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function curve(grade) {
  return grade += 5;
}
var grades = [77, 65, 81, 92, 83];
var newgrades = grades.map(curve);
console.log(newgrades); // 82, 70, 86, 97, 88
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is an example using strings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function first(word) {
  return word[0];
}
var words = ["for","your","information"];
var acronym = words.map(first);
console.log(acronym.join("")); // displays "fyi"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this last example, the acronym array stores the first letter of each word in the words array. &lt;/p&gt;

&lt;p&gt;However, if we want to display the elements of the array as a true acronym, we need to get rid of the commas that will be displayed if we just display the array elements using the implied toString() function. We accomplish this by calling thejoin() function with the empty string as the separator.&lt;/p&gt;

&lt;p&gt;The filter() function works similarly to every(), but instead of returning true if all the elements of an array satisfy a Boolean function, the function returns a new array consisting of those elements that satisfy the Boolean function. &lt;/p&gt;

&lt;p&gt;Here is an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function isEven(num) {
  return num % 2 == 0;
}
function isOdd(num) {
  return num % 2 != 0;
}
var nums = [];
  for (var i = 0; i &amp;lt; 20; ++i) {
  nums[i] = i+1;
}
var evens = nums.filter(isEven);
console.log("Even numbers: ");
console.log(evens);
var odds = nums.filter(isOdd);
console.log("Odd numbers: ");
console.log(odds);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This program returns the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Even numbers:
2,4,6,8,10,12,14,16,18,20
Odd numbers:
1,3,5,7,9,11,13,15,17,19
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is another interesting use of filter():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function passing(num) {
  return num &amp;gt;= 60;
}
var grades = [];
for (var i = 0; i &amp;lt; 20; ++i) {
  grades[i] = Math.floor(Math.random() * 101);
}
var passGrades = grades.filter(passing);
console.log("All grades: );
console.log(grades);
console.log("Passing grades: ");
console.log(passGrades);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This program displays:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;All grades:
39,43,89,19,46,54,48,5,13,31,27,95,62,64,35,75,79,88,73,74
Passing grades:
89,95,62,64,75,79,88,73,74
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, we can also use filter() with strings. Here is an example that applies the spelling rule “i before e except after c”:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function afterc(str) {
if (str.indexOf("cie") &amp;gt; -1) {
  return true;
}
  return false;
}
var words = ["recieve","deceive","percieve","deceit","concieve"];
var misspelled = words.filter(afterc);
console.log(misspelled); // displays recieve,percieve,concieve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, i think i've been able to explain what arrays are how we use them and how to use the several inbuilt functions in Javascript to perform some Array operations.&lt;/p&gt;

&lt;p&gt;In a later part of this article we shall be looking into Two-dimensional and Multi-dimensional forms of arrays, Arrays of objects and Arrays in objects.&lt;/p&gt;

&lt;p&gt;See you next time.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>array</category>
    </item>
    <item>
      <title>Simple GraphQL Query Using ExpressJs</title>
      <dc:creator>Mishael Dada</dc:creator>
      <pubDate>Sat, 23 Jul 2022 15:13:55 +0000</pubDate>
      <link>https://dev.to/mishaeldada/simple-graphql-query-using-expressjs-2n2h</link>
      <guid>https://dev.to/mishaeldada/simple-graphql-query-using-expressjs-2n2h</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In this article, I'm going to explain the basics of making a simple query request to an API using GraphQL, and ExpressJs.&lt;/p&gt;

&lt;p&gt;We will look at concepts like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Making an express server&lt;/li&gt;
&lt;li&gt;Creating our schema&lt;/li&gt;
&lt;li&gt;Testing queries using graphiql.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So first create a folder and give it any name of your choice, I'll name mine &lt;code&gt;simple-graphql-project&lt;/code&gt;&lt;br&gt;
Inside your newly created folder, open the terminal and run the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will initialize our project with npm so that we can install packages that'll be needed for the tutorial.&lt;/p&gt;

&lt;p&gt;Before we start writing the code, let's install all the dependencies we'll be needing for this project.&lt;/p&gt;

&lt;p&gt;In your terminal, run the command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i express graphql express-graphql lodash axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;or&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add express graphql express-graphql lodash axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now with all our packages installed, let's write some code:&lt;/p&gt;

&lt;p&gt;Create a file named &lt;code&gt;app.js&lt;/code&gt; – this will be our main file&lt;br&gt;
Paste the following code inside the app.js file, then I'll explain what the code means:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express')
const {graphqlHTTP} = require('express-graphql')
const schema = require('./schema/schema')

const app = express()
app.use('/graphql', graphqlHTTP({
    schema,
    graphiql: true
}))

app.listen(4000, ()=&amp;gt; {
    console.log('Started server on port 4000');
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, from the code above:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;In line 1:&lt;/code&gt; We imported our express package which is our backend framework for node js to create servers and endpoints for our project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;In line 2:&lt;/code&gt; &lt;code&gt;graphqlHTTP&lt;/code&gt;—is a module from &lt;code&gt;express-graphql&lt;/code&gt; that provides a simple way to create an Express server that runs a GraphQL API.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;In line 3:&lt;/code&gt; &lt;code&gt;schema file&lt;/code&gt; – this is a file we're yet to create, but I can tell you what this file will contain, in our schema file is where we'll write all the query(ies) we'll make to an API endpoint or an internal JSON file.&lt;/p&gt;

&lt;p&gt;For instance, in this query/ies, we will extract the exact data we want to get when we make a call to an API endpoint, and also what kind of data type those data would be.&lt;/p&gt;

&lt;p&gt;For example: if we're making a request to get a list of blog posts from an API, we expect that an ID for each post would be returned as part of the data, right? Also, we want to attribute the data type of the ID we're expecting, either it's a string or a number or maybe a boolean value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fields: () =&amp;gt; ({
    id: {type: GraphQLString},
    flight_number: { type: GraphQLInt },
    name: { type: GraphQLString },
    details: { type: GraphQLString },
    success: { type: GraphQLBoolean },
  }),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what i meant by that explanation. In this project we will make a request to a &lt;a href="https://github.com/r-spacex/SpaceX-API" rel="noopener noreferrer"&gt;SpaceX API&lt;/a&gt; and the results we want from the huge chunk of data we will be receiving from the API are: &lt;code&gt;id&lt;/code&gt; of type  &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;flight_number&lt;/code&gt; of type &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;details&lt;/code&gt; of type &lt;code&gt;string&lt;/code&gt; and &lt;code&gt;success&lt;/code&gt; of type &lt;code&gt;boolean&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;In line 7-10:&lt;/code&gt; We will pass 2 arguments into our express app function, the first is our endpoint where we will be making all the queries from.&lt;/p&gt;

&lt;p&gt;The second argument is graphqlHTTP function which we will pass our schema file containing our query so that express can interact with the GraphQL API, the second parameter &lt;code&gt;graphiql&lt;/code&gt; is the tool we will be using to test our queries.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;In line 13-15:&lt;/code&gt; This is the port where we will be starting up our express server from.&lt;/p&gt;

&lt;p&gt;So, let's jump into our schema file now, create a folder named schema and create a file inside that folder named schema.js.&lt;/p&gt;

&lt;p&gt;Paste the following code inside the schema.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const graphql = require("graphql");
const {
  GraphQLObjectType,
  GraphQLInt,
  GraphQLString,
  GraphQLSchema,
  GraphQLList,
  GraphQLBoolean,
} = graphql;
const axios = require("axios");

const LaunchType = new GraphQLObjectType({
  name: "Launch",
  fields: () =&amp;gt; ({
    id: {type: GraphQLString},
    flight_number: { type: GraphQLInt },
    name: { type: GraphQLString },
    details: { type: GraphQLString },
    success: { type: GraphQLBoolean },
  }),
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first 21 lines of our code contains our import statement statements. Our &lt;code&gt;LaunchType&lt;/code&gt; variable, is a graph object type which will contain the selected fields we want to get from our API call.&lt;/p&gt;

&lt;p&gt;Let's continue with the code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const RootQuery = new GraphQLObjectType({
  name: "RootQueryType",
  fields: {
    launch: {
      type: LaunchType,
      args: { id: { type: GraphQLString } },
      resolve(parent, args) {
        return axios
          .get(`https://api.spacexdata.com/v5/launches/${args.id}`)
          .then((res) =&amp;gt; res.data);
      },
    },
    launches: {
      type: new GraphQLList(LaunchType),
      resolve(parent, args) {
        return axios
          .get("https://api.spacexdata.com/v5/launches")
          .then((res) =&amp;gt; res.data);
      },
    },
  },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;RootQuery&lt;/code&gt; object will contain 2 queries that we'll be making, firstly we want to get details about a particular launch by passing the id as a query string to the API URL and the second query request is to get details of all the launch that had been made.&lt;/p&gt;

&lt;p&gt;So for the first query which is &lt;code&gt;launch&lt;/code&gt;: we passed in a type “LaunchType” and also an “args” which is the argument/query string we will be using to fetch the details for a particular launch detail. In the resolve function we also pass two arguments parent and args, we won't be talking about the parent argument for now. Inside the resolve function, we return the data we get from querying our API endpoint.&lt;/p&gt;

&lt;p&gt;The second query which is &lt;code&gt;launches&lt;/code&gt;: if you notice we used a type &lt;code&gt;GraphQLList&lt;/code&gt; because we're getting not just one data but multiple data, so we pass our results into a list/array.&lt;/p&gt;

&lt;p&gt;After we're done writing all our query functions, then we export our schema file, so we can use it in our app.js file.&lt;/p&gt;

&lt;p&gt;So include this code inside your schema.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = new GraphQLSchema({
  query: RootQuery,
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can test our queries by going to our terminal and running the command:&lt;br&gt;
&lt;code&gt;node app.js&lt;/code&gt;&lt;br&gt;
You should see &lt;code&gt;Started server on port 4000&lt;/code&gt;in your terminal&lt;/p&gt;

&lt;p&gt;Now open your browser and navigate to &lt;code&gt;localhost:4000/graphql&lt;/code&gt; if you remember, that's the endpoint we created for our GraphQL API.&lt;/p&gt;

&lt;p&gt;On your browser, you should see something like this:&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1658585386757%2FBq1solT58.png%2520align%3D" 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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1658585386757%2FBq1solT58.png%2520align%3D" alt="graphiql.png"&gt;&lt;/a&gt;&lt;br&gt;
This is graphiql, the tool we will be using to test our endpoints:&lt;/p&gt;

&lt;p&gt;So let's get the details of all the launches that have been made at SpaceX:&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1658586204642%2FtXDxVIvuSX.png%2520align%3D" 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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1658586204642%2FtXDxVIvuSX.png%2520align%3D" alt="q2.png"&gt;&lt;/a&gt;&lt;br&gt;
Copy the id of any data, then we use it to make the second query to get details of an individual launch.&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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1658586280525%2FVJexEaiIC.png%2520align%3D" 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%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1658586280525%2FVJexEaiIC.png%2520align%3D" alt="q1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So we've successfully made our query requests and have got our desired outcome.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mishael1-d/graphql-spacex-project" rel="noopener noreferrer"&gt;Link to source code:&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;From this tutorial we made API request to external API, we can also use GraphQL to fetch data from a JSON file in our project and also more advanced functionalities.&lt;/p&gt;

&lt;p&gt;If you like to know more about GraphQL use the comment section to tell me what you'll like me to write on next, you can also check out my previous articles, you'll like them.&lt;/p&gt;

&lt;p&gt;Thank you till next time.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>graphql</category>
      <category>api</category>
    </item>
    <item>
      <title>How To Get Started in the Tech Industry</title>
      <dc:creator>Mishael Dada</dc:creator>
      <pubDate>Tue, 31 May 2022 05:32:50 +0000</pubDate>
      <link>https://dev.to/mishaeldada/how-to-get-started-in-the-tech-industry-1k0i</link>
      <guid>https://dev.to/mishaeldada/how-to-get-started-in-the-tech-industry-1k0i</guid>
      <description>&lt;h3&gt;
  
  
  Getting Started in Tech
&lt;/h3&gt;

&lt;p&gt;I'll like to start this article by introducing myself and what I did before I eventually transitioned into tech, and in this article, I'll be explaining how you can transition into the tech world without facing the same challenges I faced.&lt;br&gt;
So let's get right into it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;My name is Mishael Dada, I'm from Nigeria, and I'm a graduate of &lt;strong&gt;Biochemistry&lt;/strong&gt; who transitioned to be a Front-end Developer and a UI Designer.&lt;br&gt;
My journey into tech started in the year 2019 after graduating from the university, I launched out to learn &lt;em&gt;Cyber Security&lt;/em&gt; after watching a movie called &lt;em&gt;hackers&lt;/em&gt;, well I'm sure this movie has pushed a lot of people into the cyber security field than any other movie except maybe you've watched &lt;em&gt;matrix&lt;/em&gt; too. So I joined a cyber security community &lt;a href="https://twitter.com/DiaryOfHackers"&gt;Diary of Hackers (DoH)&lt;/a&gt; I started learning &lt;em&gt;python&lt;/em&gt;, &lt;em&gt;shell(bash)&lt;/em&gt; but I wasn't really getting the hang of it, I couldn't understand some of the basic concepts like TCP/IP model, HTTPS Methods and so on, the journey at first is always really stressful (&lt;em&gt;as a beginner put this at the front of your mind&lt;/em&gt;), so I contacted a friend of mine &lt;a href="https://www.linkedin.com/in/james-t-541037a6/"&gt;Teddy&lt;/a&gt; from my university days who I know was into programming then (currently a Data Engineer), so after a long chat with him he introduced me to another coursemate of ours &lt;a href="https://www.linkedin.com/in/ebube-agwaze/"&gt;Ebube(aka Busko)&lt;/a&gt;.&lt;br&gt;
Now, this whole article would never exist without the two guys I've mentioned above (&lt;a href="https://www.linkedin.com/in/james-t-541037a6/"&gt;Teddy&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/ebube-agwaze/"&gt;Ebube&lt;/a&gt;), I'll like to use this medium to appreciate them for dragging me fully into the tech field cause if they didn't probably I'll be sitting in the corner of a room right now washing test tubes.&lt;br&gt;
So, it's time to show you how to transition into tech fully based on my own experience it might probably not be the right way for some people but it might work for you, so sit tight and let's get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Transitioning into the Tech Industry
&lt;/h3&gt;

&lt;h4&gt;
  
  
  What exactly is Tech Industry?
&lt;/h4&gt;

&lt;p&gt;Dr Myles Munroe once said: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"When purpose is not known, abuse is inevitable!"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So therefore I can say that&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"When the definition of a thing is not known, misunderstanding is inevitable"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most times when you ask people what the tech industry means, their answer has to do with the full name "Technology" they're not wrong at all but there's a keyword missing there and that keyword is &lt;em&gt;innovation&lt;/em&gt;, so, the &lt;em&gt;Tech Industry&lt;/em&gt; can simply be defined as an industry, focused mainly on &lt;strong&gt;innovation&lt;/strong&gt;, bringing ideas to life using different technologies. So I guess we know what the tech industry means now, so next up is &lt;em&gt;Steps to getting into the Tech Industry&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Steps to getting into the Tech Industry
&lt;/h4&gt;

&lt;p&gt;Don't forget what I said earlier this is just my own opinion of how to get into the tech field yours might be different but if it happens that you are a complete noob then this will work for you, so let's take a deep dive into it.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 1: Finding a Niche of Choice
&lt;/h5&gt;

&lt;p&gt;For many of us at first, we thought the Tech Industry was just about writing hundreds and thousands of lines of codes and because of that we rushed into learning one programming language or the other (just like I did in the beginning) but here's the good new - the Tech industry isn't just about writing codes and sitting in front of a PC with a black background and green text.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Hezn2ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1652412640786/ywMRd5yPY.jpg%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Hezn2ma--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1652412640786/ywMRd5yPY.jpg%2520align%3D%2522left%2522" alt="hack screen.jpg" width="" height=""&gt;&lt;/a&gt;&lt;br&gt;
The industry also has a category of non-coding skills you can adopt I'll be giving you a list of those non-coding skills below, but if you're interested in finding out more and their roles you can find that information &lt;a href="https://www.benjamindada.com/20-top-tech-skills-that-requires-no-coding-skill/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;UI/UX Design&lt;/li&gt;
&lt;li&gt;Graphics Design&lt;/li&gt;
&lt;li&gt;Technical Writer&lt;/li&gt;
&lt;li&gt;Tech Support Specialist&lt;/li&gt;
&lt;li&gt;Project management&lt;/li&gt;
&lt;li&gt;Product Management&lt;/li&gt;
&lt;li&gt;Digital Marketing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and so.&lt;br&gt;
There are thousands of freelancers who earn millions monthly just from these skills, you can do that too pick up a course today on platforms like &lt;a href="https://youtube.com"&gt;Youtube&lt;/a&gt;, &lt;a href="https://udemy.com"&gt;Udemy&lt;/a&gt;, &lt;a href="https://udacity.com"&gt;Udacity&lt;/a&gt; and many more. As a kind gesture, at the end of this article, I'll be sharing links to some resources where you can learn most of these above-mentioned skills for free as well as some paid Udemy courses I have.&lt;/p&gt;

&lt;p&gt;So with that said the coding aspect of the Tech Industry is a massive one and it can be likened to the width of the sky and I'm sure you know that's really really massive.&lt;br&gt;
Below is a list of the categories in the coding aspect of the Tech Industry:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Software Engineering&lt;/li&gt;
&lt;li&gt;Web Development&lt;/li&gt;
&lt;li&gt;Game Development&lt;/li&gt;
&lt;li&gt;Mobile App Development&lt;/li&gt;
&lt;li&gt;Cyber Security&lt;/li&gt;
&lt;li&gt;Artificial Intelligence&lt;/li&gt;
&lt;li&gt;Machine Learning&lt;/li&gt;
&lt;li&gt;Data Science&lt;/li&gt;
&lt;li&gt;Cloud Engineering&lt;/li&gt;
&lt;li&gt;BlockChain Development&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and many more, Note: Most of these categories listed above have sub-categories for example a Web Developer can either be a Frontend, a Backend or a FullStack Developer.&lt;/p&gt;

&lt;p&gt;Now after going through this list, DYOR (Do Your Own Research), find a niche or a category you're interested in or where you're passion-driven to go into because with time the only thing that'll keep you moving against all odds is your passion.&lt;br&gt;
Are you someone who is very good with colours and very creative with designs (e.g. students good in architecture, building tech) you can give UI/UX a try, are you a cashier who's having difficulty keeping track of daily transactions cause of the large influx of customers? try building an app that'll help you do that. I believe everyone has a space in the tech industry, as one of my mentors &lt;a href="https://twitter.com/DThompsonDev"&gt;Danny Thompson&lt;/a&gt;(even though he doesn't know I exist) would say "It's never too late to learn how to code and there's a space for everyone", so, find your passion then, what next?&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 2: Find a Roadmap
&lt;/h5&gt;

&lt;p&gt;After you must have decided to go into one of the categories, the next question on your mind is so where do I start from?, what do I learn?, how do I learn what I need to learn? well, that's the essence of a roadmap.&lt;br&gt;
A roadmap is a visualization of a strategic plan. You need a bold vision for what you want to achieve and a solid plan for how you will turn your aspirations into reality. Let's take for example you're going to see a relative who lives in another state, you don't just get into your car and start driving in any direction right? you follow a path that leads to your destination right? well lucky for us thousands of people have gone down the paths you've chosen and they've laid down a path for us to follow to get to our destination.&lt;br&gt;
I almost forgot to say this, different career paths here use different stacks of programing language but a programming language can also be used in multiple stacks for example Javascript and Python can be used in more than 60% of the stacks you'll find, I'll attach an image below for better understanding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cyrLVKFy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1652415729155/EZBFiaPfS.jpg%2520align%3D%2522left%2522" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cyrLVKFy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1652415729155/EZBFiaPfS.jpg%2520align%3D%2522left%2522" alt="IMG_0007.jpg" width="" height=""&gt;&lt;/a&gt;&lt;br&gt;
As you can see each sector has a stack of languages, one mistake I made and I see new developers making today is "Learning all the languages in a stack at the same time", please don't do that you're only going to waste your time and gain nothing at the end, learn one language at a time if your stack is "*Javascript, Java, Python" pick one language let's say you pick "Java", find a roadmap for learning java you can find one &lt;a href="https://roadmap.sh/java"&gt;here&lt;/a&gt; stick to learning it well then move to the next, in a later section we'll talk about how to learn how to code efficiently.&lt;br&gt;
Below are links to a list of roadmaps to different career paths you might have chosen, if you don't find any relating to the path you've chosen, do well to inform me so I can add it up later.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-to-learn-web-dev-in-2021-roadmap/"&gt;FreeCodeCamp Web Developer Roadmap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://roadmap.sh/"&gt;Developer Roadmaps&lt;/a&gt; includes
-- &lt;a href="https://roadmap.sh/frontend"&gt;Frontend&lt;/a&gt;
-- &lt;a href="https://roadmap.sh/backend"&gt;Backend&lt;/a&gt;
-- &lt;a href="https://roadmap.sh/andriod"&gt;Andriod&lt;/a&gt;
-- &lt;a href="https://roadmap.sh/python"&gt;Python&lt;/a&gt;
-- &lt;a href="https://roadmap.sh/java"&gt;Java&lt;/a&gt;
-- &lt;a href="https://roadmap.sh/go"&gt;Go&lt;/a&gt;
-- &lt;a href="https://roadmap.sh/devops"&gt;DevOps&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you've picked the languages you want to learn and you've found a roadmap for it next is "Where do I learn from?"&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 3: Find Learning Resources
&lt;/h5&gt;

&lt;p&gt;Getting the right tutorial video for you to kick off your journey can prove to be quite difficult especially if you're transitioning into tech with no CS background. So, I've made available a compilation of youtube channels, videos and files for different categories which you can check out, and if you find your desired career path then you start learning but, I must say this &lt;strong&gt;Do not watch too many tutorial videos at a time, get one video stick to it till the end before moving to the next on&lt;/strong&gt;, we'll talk about challenges you'll face while learning in another section of this article.&lt;br&gt;
So below is a list of resources worth hundreds of dollars and I'll be sharing it for free cause I also got it for free, finally if you don't find a video of your choice let me know so I can share other materials with you.&lt;/p&gt;

&lt;h5&gt;
  
  
  List of Youtube Channels
&lt;/h5&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/Freecodecamp"&gt;FreeCodeCamp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/TraversyMedia"&gt;TraversyMedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/WebDevSimplified"&gt;WebDevSimplified&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/SimplilearnOfficial"&gt;SimplilearnOfficial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/DesignCourse"&gt;DesignCourse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/programmingwithmosh"&gt;programmingwithmosh&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/CleverProgrammer"&gt;CleverProgrammer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/kepowob"&gt;Kevin Powell - CSS guru&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/CodingAddict"&gt;CodingAddict&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/c/Codevolution"&gt;Codevolution&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h5&gt;
  
  
  Google Drive and Mega Files
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/wQp0jaSC#cE7-P1fX0FkxU2LXAHm80A"&gt;700gb Udemy Courses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/drive/folders/1BnqNr49J_dLbS37gUwJGo70Yv-ZPSXum"&gt;The complete android developer course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/drive/folders/1q2sOBNU4lPBkwtF1Msl6uCACBV5TUGWD"&gt;Udemy Cybersecurity Collection&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/drive/folders/1XDkebxwFxtMCOcL-7_R6F7yqGI5Ggf_A"&gt;The Complete Front-end Web Developer Course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/folderview?id=0By6kYdZ8joOUYnVNSktaVVRuYWc"&gt;Udemy Kotlin Developer Masterclass&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/drive/folders/1aaR9QBkb6bBLUAPER_BBK79JrzSUPPAa?usp=sharing"&gt;The Complete Web Developer Course 2022 zero-hero&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/gRJBkYJZ#3FFR6aY0mz2R9CAdhGKZ2w"&gt;Andriod 94+ hour course + 84 apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/nT52ibQT#r6yWLjqBt_yTNttzFkW40Q"&gt;Become a Blockchain Developer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/drive/folders/1PPorQBXOnwqn8NXfBiyuBly5dBatHE1v?usp=sharing"&gt;Complete Data Science and Machine Learning Bootcamp 2020&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/R0Ew0KRY#YJ7z3_-oU-aCex295onbqQ"&gt;Digital Marketing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/angSgDqb#KVmG1lCoxuBF-mYQP5PdQQ"&gt;Adobe Xd UI/UX Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/vtwRFIqS#LEmRLdzqVDXFfQ7bRWRSlw"&gt;Figma UI/UX Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/eoxnWRAS#ITKK9j9I5pLdHbFTzhHTgg"&gt;Graphic Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mega.nz/folder/qjYQGb7A#6r27aaB-Rc8JDRnMEAjlIg"&gt;CyberSecurity Foundation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drive.google.com/drive/u/0/folders/1oj6q7Ram4JGSWeNrrTExYKydT5ATndZb"&gt;1.7TB All Courses&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I guess with this we're ready for the last step of our transition into tech.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 4: Start
&lt;/h5&gt;

&lt;p&gt;Well as simple as it may sound this happens to be the most difficult step to take when it comes to transitioning into the tech industry. You've found your passion-driven career, you know the stack of programming languages to learn, you've gotten the roadmap for a specific language you've decided to start with, and you have all your learning materials available next thing to do is &lt;strong&gt;START&lt;/strong&gt; and as you're starting always remember it takes &lt;strong&gt;TIME&lt;/strong&gt; to become good at any programming language and it might seem as if you can't do it but keep trying.&lt;/p&gt;

&lt;h5&gt;
  
  
  Things To Do To Enable You to Start Well
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Make a timetable: This I think is one of the effective ways of starting well, create time for yourself and be ready to sacrifice a lot of your time to learn, as a beginner when I started learning how to code it was during the COVID-19 pandemic I spend approximately 14+ hours daily in front of my PC, yours doesn't have to be 14 hours yours can be 4 hours, 2 hours daily depending on your daily schedule.&lt;/li&gt;
&lt;li&gt;Get a Mentor: This is one of the things I wasn't opportune to have during my early days of learning, a good mentor is able to impact knowledge worth 10 hours in 40 minutes, he's able to see your mistake at a glance and tell you how to correct it immediately and this I can tell you from experience will save you lot of hours of debugging. So go on Twitter or LinkedIn check through profiles and get yourself a mentor, i'm still a junior dev so I can't be anyone's mentor yet, but if you happen to run into any form of bug in your code you can reach out to me.&lt;/li&gt;
&lt;li&gt;Get a Learning Partner: While this might not work for everyone, it works really well for others, getting someone who is starting out like you and connect with him/her.&lt;/li&gt;
&lt;li&gt;Set Goals: This is my favourite part, I do this very very often and it has proved to be more effective in boosting productivity than any other method. Set targets for yourself - for me personally I set daily, weekly, monthly and yearly targets. By the beginning of the year, I have a plan for projects I wanna work on, tasks I'll like to accomplish and so on for example one of my plan for the year was (using was cause Its no longer a plan) to get a full-time role which currently I've achieved. So I urge you as you are starting out to make plans for yourself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Well with these few points i wish you good luck in your journey.&lt;br&gt;
In case of any suggestions to improve this article or if you have any questions, please reach out to me.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Do I implement Web Scraping With NodeJS</title>
      <dc:creator>Mishael Dada</dc:creator>
      <pubDate>Wed, 25 May 2022 06:28:51 +0000</pubDate>
      <link>https://dev.to/mishaeldada/how-do-i-implement-web-scraping-with-nodejs-21c6</link>
      <guid>https://dev.to/mishaeldada/how-do-i-implement-web-scraping-with-nodejs-21c6</guid>
      <description>&lt;p&gt;Hello everyone,&lt;/p&gt;

&lt;p&gt;I have a task to scrape an instagram URL (&lt;a href="https://www.instagram.com/%7Busername%7D/?__a=1"&gt;https://www.instagram.com/{username}/?__a=1&lt;/a&gt;) and get the graphql data it returns. I've tried few methods some worked and later on stopped working.&lt;br&gt;
Please if you know any 100% working method, i'll be happy to learn.&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
