<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: ayeolakenny</title>
    <description>The latest articles on Forem by ayeolakenny (@ayeolakenny).</description>
    <link>https://forem.com/ayeolakenny</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%2F193607%2Fbf587bf6-5366-4496-aa3d-96826bc064a7.jpg</url>
      <title>Forem: ayeolakenny</title>
      <link>https://forem.com/ayeolakenny</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ayeolakenny"/>
    <language>en</language>
    <item>
      <title>Why Rest api's are Good and Graphql api's Better</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Sat, 15 May 2021 09:25:50 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/why-rest-api-s-are-good-and-graphql-api-s-better-3j4e</link>
      <guid>https://forem.com/ayeolakenny/why-rest-api-s-are-good-and-graphql-api-s-better-3j4e</guid>
      <description>&lt;p&gt;GraphQL was internally developed by Facebook in 2012 and was later open sourced in 2015. The idea came up when facebook needed to rebuild its mobile native application, Facebook needed a data-fetching API powerful enough to describe all of Facebook yet simple enough to be easy to learn by their developers, now graphql powers tech giants like Netflix, Twitter, Shopify etc.&lt;/p&gt;

&lt;p&gt;Now wondering what it is about graphql that outweighs rest, well lets get on with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Fetching
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fHso8bAz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--Ihk6Q-tj--/c_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_420%2Cq_auto%2Cw_1000/https://dev-to-uploads.s3.amazonaws.com/i/57q0p05ztpasjs90wpkd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fHso8bAz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--Ihk6Q-tj--/c_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_420%2Cq_auto%2Cw_1000/https://dev-to-uploads.s3.amazonaws.com/i/57q0p05ztpasjs90wpkd.png" alt="Graphql and Rest data fetching"&gt;&lt;/a&gt;&lt;br&gt;
Data fetching is one of the obvious reasons we use api's, graphql makes data fetching easier by only exposing one endpoint to access data from the server, unlike rest where we have to make multiple requests to multiple endpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Network Requsts
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rCqnIhf3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.testproject.io/wp-content/uploads/2020/05/Screenshot-2020-06-01-at-10.42.35-PM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rCqnIhf3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.testproject.io/wp-content/uploads/2020/05/Screenshot-2020-06-01-at-10.42.35-PM.png" alt="Graphql and Rest network requests"&gt;&lt;/a&gt;&lt;br&gt;
As said earlier, Graphql exposes only one endpoint which reduces trips and network requests to the server to fetch data, while Rest exposes multiple endpoints and increases trips and network requests to the server.&lt;br&gt;
As you can see in the image above, to grab a users profile, users posts and users followers with graphql we only make a request to the server while we make 3 requests to the server using rest apis to grab all the data we need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Over/Under Fetching
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Graphql is a declarative data fetching specification and query language.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EN_Aisp3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-media-1.freecodecamp.org/images/7oVDwxTOP3hSztQqeOs98Qp8jXHF-MvmqWUl" alt="Graphql fetching"&gt;
we only fetch what we need from the server by constructing our query to only include what we need.&lt;/li&gt;
&lt;li&gt;Rest apis gives you more or less data than is needed for the client at a point.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n1R4lVuq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://image.slidesharecdn.com/elixirgraphqlabsinthe-chicagoelixir2019-190412180345/95/elixir-graphql-absinthe-20190410-15-638.jpg%3Fcb%3D1555092335" alt="Rest fetching"&gt;
This makes the server spit unecessary data that would not get used by the client, therefore making uneccessary requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Api Versioning
&lt;/h2&gt;

&lt;p&gt;When the arise for addition of new features come in, you can easily add additional fields, queries, mutations etc to the server and other parts would not be affected, also it is easier to remove old features and make them backward compatible without any breaking changes.&lt;/p&gt;

&lt;h1&gt;
  
  
  Should I Abandon REST for GraphQL?
&lt;/h1&gt;

&lt;p&gt;Graphql can be a life saver when when building scalable applications, but you do not need to rewrite or migrate applications that have been designed to use REST api. Rather you should plan to use GraphQL for future applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;REST for sure is not going anywhere soon. For most small applications, there would not be significant increase in performance over REST, the real magic of GraphQL plays in as applications scale and the application becomes bigger.&lt;/p&gt;

</description>
      <category>graphql</category>
    </item>
    <item>
      <title>Create a Graphql server with Nodejs, Typescript and Graphql</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Mon, 11 Jan 2021 20:06:26 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/create-a-graphql-server-with-nodejs-typescript-and-graphql-263b</link>
      <guid>https://forem.com/ayeolakenny/create-a-graphql-server-with-nodejs-typescript-and-graphql-263b</guid>
      <description>&lt;p&gt;According to their docs &lt;a href="https://graphql.org/" rel="noopener noreferrer"&gt;graphql.org&lt;/a&gt;, GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.&lt;/p&gt;

&lt;p&gt;Before you start with this blog post I'll recommend you know at least a good chunk on of typescript, graphql and nodejs, so lets dive in and get going :).&lt;/p&gt;

&lt;p&gt;Firstly we would have to setup our project with node and typescript, run &lt;code&gt;npm init -y&lt;/code&gt; to setup a package.json file.&lt;/p&gt;

&lt;p&gt;We are going to need some packages for this project, simply install them by running the following command.&lt;br&gt;
&lt;code&gt;yarn add express express-graphql graphql&lt;/code&gt;&lt;br&gt;
or&lt;br&gt;
&lt;code&gt;npm install express express-graphql graphql&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After installing the main packages, we would also need some dev dependencies which would only be useful during development.&lt;br&gt;
&lt;code&gt;yarn add @types/express @types/express-graphql @types/graphql @types/node typescript nodemon -D&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you noticed, we installed the types for all our main packages as dev dependencies, typescript requires this to validate the types when working with the main packages or else it throws errors, keep this in mind.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After installing all the packages we would need to create the server, we would need some kind of configuration to tell typescript what's going on in our project and how to deal with it, luckily we can get this configuration through a simple npx command,&lt;br&gt;
&lt;code&gt;npx tsconfig.json&lt;/code&gt;&lt;br&gt;
Then choose the framework you are working with, in our case it is node&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Pick the framework you're using (Use arrow keys)
&amp;gt; react
  react-native
  node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And zoom, you get a tsconfig.json file in the root of your project.&lt;/p&gt;

&lt;p&gt;Go into the tsconfig.json file and check for your outDir and set it to "./build" and rootDir to "./".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"outDir: "./build",
"rootDir: "./",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: the &lt;code&gt;outDir&lt;/code&gt; tells typescript where to save your compiled typescript code to, and the &lt;code&gt;rootDir&lt;/code&gt; tells typescript where to find your typescript code to be compiled.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Looks like the configuration is becoming overwhelming, I promise you this is the last configuration haha!.&lt;/p&gt;

&lt;p&gt;Now go to your package.json file and locate the &lt;code&gt;"scripts"&lt;/code&gt; section and add the following scripts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
  "start": "nodemon build/server.js",
  "build": "tsc -w server.ts"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The build command checks for changes in our typescript file and bundles the javascript code.&lt;br&gt;
The start command checks for changes in our javascript code and runs the bundled javascript code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now lets get into the code hurrayyy!!!&lt;/p&gt;

&lt;p&gt;Create a file named &lt;code&gt;server.ts&lt;/code&gt; in the root of your project and import the your dependencies, initialize express and setup your localhost.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import express, { Request, Response } from "express";

//express initialization
const app = express();

//PORT
const PORT = 4000;

app.get("/", (req: Request, res: Response) =&amp;gt; {
    res.send("Hello World!");
});

//localhost setup
app.listen(4000, () =&amp;gt; {
  console.log("Graphql server now up at port 4000")
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open your terminal in your and run &lt;code&gt;yarn build&lt;/code&gt; then &lt;code&gt;yarn start&lt;/code&gt; or &lt;code&gt;npm build&lt;/code&gt; then &lt;code&gt;npm start&lt;/code&gt;, open your browser and navigate to &lt;code&gt;http://localhost:4000&lt;/code&gt;, you should see the world &lt;code&gt;Hello World!&lt;/code&gt; printed out.&lt;/p&gt;

&lt;p&gt;Now lets get into the graphql part&lt;/p&gt;

&lt;p&gt;We would add the &lt;code&gt;express-graphql&lt;/code&gt; dependecy and some more code which would help us setup graphql playground in our browser.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The graphql playround is where we test our graphql queries, mutations and all other stuffs pertaining to graphql on the frontend, which i would talk about im my next post.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import express, { Request, Response } from "express";
import { graphqlHttp } from "express-graphql";

//express initialization
const app = express();

//PORT
const PORT = 4000;

app.get("/", (req: Request, res: Response) =&amp;gt; {
    res.send("Hello World!");
});

//graphql playground setup code
app.use(
  "/graphql",
  graphqlHTTP({
    graphiql: true
  })
);

//localhost setup
app.listen(4000, () =&amp;gt; {
  console.log("Graphql server now up at port 4000")
});

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The graphiql set to true is what enables our graphql playround in the browser, if set to false it automatically disables the playground.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now in your browser, go to &lt;code&gt;http://localhost:4000/graphql&lt;/code&gt;&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%2Fi%2Fe36ds2sh7fmexcl2yaay.jpg" 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%2Fi%2Fe36ds2sh7fmexcl2yaay.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You should see something like this.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hurray, you have created your first Graphql server!!! :).&lt;/p&gt;

&lt;h3&gt;
  
  
  We would be talking about queries in my next post, see you there ;)
&lt;/h3&gt;

</description>
      <category>graphql</category>
      <category>node</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Nodejs setup with Typescript</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Thu, 07 Jan 2021 00:35:09 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/nodejs-setup-with-typescript-579j</link>
      <guid>https://forem.com/ayeolakenny/nodejs-setup-with-typescript-579j</guid>
      <description>&lt;p&gt;Setting up Nodejs and Typescript was a little bit of a hurdle for me at the time i was beginning, but turns out it was way easier than i thought. This is going to help you cover a decent set up to get you going.&lt;/p&gt;

&lt;p&gt;Firstly i dont think i need to define both technologies, i assume you already know them before reading this post :), if not head over to &lt;a href="https://nodejs.org/en/"&gt;Nodejs.org&lt;/a&gt; and &lt;a href="https://www.typescriptlang.org/"&gt;typescriptlang.org&lt;/a&gt; to find out about them, so lets get going.&lt;/p&gt;

&lt;p&gt;Navigate to your project root folder and run the following terminal commands&lt;br&gt;
&lt;code&gt;npm init -y&lt;/code&gt;&lt;br&gt;
After that had initialized a package.json file for you run&lt;br&gt;
&lt;code&gt;npx tsconfig.json&lt;/code&gt;&lt;br&gt;
let it run the choose the technology you are using which is node&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Pick the framework you're using: (use arrow keys)
&amp;gt; react
  react-native
  node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When that runs finish it automatically generates a suitable tsconfig.json file for your node project.&lt;br&gt;
After that you would need to install some dev dependencies&lt;br&gt;
&lt;code&gt;yarn add -D @types/node typescript&lt;/code&gt;&lt;br&gt;
or&lt;br&gt;
&lt;code&gt;npm i @types/node typescript -D&lt;/code&gt;&lt;br&gt;
these are basic dependencies node needs to run typescript.&lt;br&gt;
After that add the following scripts to your package.json file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
   "start": "node dist/index.js",
   "watch": "tsc -w"
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dist folder is produced with your compiled javascript by tsconfig when you run the watch command on your typescript file.&lt;br&gt;
Create a typescript file in your root and run &lt;code&gt;yarn watch&lt;/code&gt; or &lt;code&gt;npm watch&lt;/code&gt; then also run the start command &lt;code&gt;yarn start&lt;/code&gt; or &lt;code&gt;npm start&lt;/code&gt; and watch tsconfig compile your typescript file to javascript in the dist folder.&lt;/p&gt;

&lt;p&gt;I hope i helped, goodluck :).&lt;/p&gt;

</description>
      <category>node</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CovidHelpBot Twillio Hackathon Submission</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Wed, 29 Apr 2020 20:27:11 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/covidhelpbot-twillio-hackathon-submission-363m</link>
      <guid>https://forem.com/ayeolakenny/covidhelpbot-twillio-hackathon-submission-363m</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;I built a chatbot that Helps in relieving the stress of health workers by helping people know their present covid-19 status and advises them on what to do based on their answers. It provides people with live updates of the virus across over 100+ countries, and also enlightens people on the most common FAQ's and myths around the covid-19 virus.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo Link
&lt;/h2&gt;

&lt;p&gt;It is a chat based bot integrated with whatsapp and programmable chat&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;

&lt;p&gt;Everything was done on the Twiliio console.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I built it (what's the stack? did I run into issues or discover something new along the way?)
&lt;/h2&gt;

&lt;h4&gt;
  
  
  How i built it
&lt;/h4&gt;

&lt;p&gt;I built a chatbot with nodejs, using Twilio autopilot and Twillio functions,&lt;br&gt;
I also integrated it with whatsapp and programmable chat.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack1.jpg" 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%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack1.jpg" alt="Whatsapp Simulation"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack2.jpg" 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%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack2.jpg" alt=" mssg Simulation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Stack
&lt;/h4&gt;

&lt;p&gt;The project was fully built on nodejs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Issues
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ran into some issues with the autopilot simulator, I the autopilot simulator was not adding line breaks in the output even when i added it in the code.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack3.PNG" alt="code"&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack4.PNG" alt="simulator"&gt;
&lt;/li&gt;
&lt;li&gt;Could not add images to my with my text, throws an error
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack6.PNG" alt="simulator"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Additional Resources/Info
&lt;/h2&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%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack8.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%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack8.PNG" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack7.jpg" 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%2Ftwiliohackathon.s3.amazonaws.com%2Ftwiliohack7.jpg" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
    </item>
    <item>
      <title>Placeholder title</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Sat, 04 Apr 2020 01:12:52 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/placeholder-title-4eai</link>
      <guid>https://forem.com/ayeolakenny/placeholder-title-4eai</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;I would be building a chatbot that helps detect if a person is infected with covid19&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo Link
&lt;/h2&gt;

&lt;p&gt;Coming soon&lt;/p&gt;

&lt;h2&gt;
  
  
  Link to Code
&lt;/h2&gt;

&lt;p&gt;Coming soon&lt;/p&gt;

</description>
      <category>twiliohackathon</category>
    </item>
    <item>
      <title>Golang</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Thu, 14 Nov 2019 15:46:15 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/golang-1lhp</link>
      <guid>https://forem.com/ayeolakenny/golang-1lhp</guid>
      <description>&lt;h1&gt;
  
  
  Part 1
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;G&lt;/strong&gt;olang also known as &lt;code&gt;GO&lt;/code&gt; is an open source computer programming language created by Google, it was developed at Google in 2007 by &lt;em&gt;Robert Griesemer&lt;/em&gt;, &lt;em&gt;Rob Pike&lt;/em&gt; and &lt;em&gt;Ken Thompson&lt;/em&gt;, and was officially released and introduced to the public in 2009.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FCnPK1TtWgAQTDOn%3Fformat%3Djpg%26name%3Dsmall" 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%2Fpbs.twimg.com%2Fmedia%2FCnPK1TtWgAQTDOn%3Fformat%3Djpg%26name%3Dsmall" alt="Golang Developers"&gt;&lt;/a&gt;&lt;/p&gt;
From the left: Robert Griesemer, Rob Pike and Ken Thompson



&lt;p&gt;&lt;strong&gt;What Is Golang&lt;/strong&gt;&lt;br&gt;
Golang is a general purpose programming language, making it useful in a wide range of areas, varying from web apps, network servers, mobile apps and machine learning, just to mention a few.&lt;br&gt;
Golang is a statically typed and compiled programming language like the C family.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, playground"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="n"&gt;Hello&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;playground&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://play.golang.org/p/HmnNoBf0p1z" rel="noopener noreferrer"&gt;Run in Playground&lt;/a&gt;&lt;br&gt;
Golang comes with some amazing features like memory safety, garbage collection, structural typing and concurrency, which I would go through as we move further in this article.&lt;br&gt;
However the Golang programming language is engineered for building larger scale and complex software, projects that involves distributed networks, cloud services and other backend technologies, it can also be very useful in solving problems encountered in complex software infrastructure as you scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some Major Features Of Golang&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compiled Programming Language: Golang generates binaries for your applications, complete with dependencies, no iinterpreters or run-time installations are required. In simple terms Golang generates machine code directly from the source code and not from interpreters, in this case no pre-runtime translation takes place, making it a very fast programming language.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fblog.charmes.net%2Fimages%2Fgopherswrench.jpg" alt="Golang Image"&gt; &lt;/li&gt;
&lt;li&gt;Error Handling: Golang is a statically typed programming language, that supports type safety, errors are caught by the compiler before execution.
Go codifies errors with the built-in error interface:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="k"&gt;package&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; 
&lt;span class="n"&gt;prog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;go&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="k"&gt;package&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;found&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="k"&gt;type&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://play.golang.org/p/YogGzKzN1L9" rel="noopener noreferrer"&gt;Run in Playgroung&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Error values are used just like any other value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;

&lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An error occurred:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="k"&gt;package&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; 
&lt;span class="n"&gt;prog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;go&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="k"&gt;package&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;found&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://play.golang.org/p/LEm3iCakR2p" rel="noopener noreferrer"&gt;Run in Playground&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Garbage collection: This is one of the exciting features of Golang, havr you ever thought of how messages are pushed in real-time that fast? Low latency garbage collection plays an important role in this.
In simple terms garbage collection is the process of freeing memory space that is not being used, this process happens in a concurrent way while the program is running and not before or after execution of the program. Concurrency would be explained as we go further into the article.
Read more on implementing memory management with Golang’s garbage collector &lt;a href="https://hub.packtpub.com/implementing-memory-management-with-golang-garbage-collector/" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Multi-Paradigm: Golang supports multiple programming paradigms including, Object Oriented Programming(OOP) without inheritance and functional programming.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ftalks.golang.org%2F2012%2Fwaza%2Fgophercomplex1.jpg" alt="Golang Image"&gt;
&lt;/li&gt;
&lt;li&gt;Concurrency: Basically this is simply the ability of the program to do multiple things at the same time, which allows it to handle numerous task at once in a given period of time. Golang has a very good support for concurrency using goroutines and channels.&lt;/li&gt;
&lt;li&gt;Goroutines: A goroutine is a function or method that is capable of running concurrently with other functions or methods.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Printing from goroutine"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Printing from main"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="n"&gt;Printing&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="n"&gt;goroutine&lt;/span&gt;
&lt;span class="n"&gt;Printing&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://play.golang.org/p/uIADiGYg1J-" rel="noopener noreferrer"&gt;Run in Playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the code snippet above, we have a function print which is just printing a string, in the main function, we have called this function concurrently by using  &lt;code&gt;go&lt;/code&gt; as a prefix. So now we have 2 goroutines, first our main function and second our print function. We made the main goroutine to sleep for 1 second so that &lt;code&gt;go print()&lt;/code&gt; has enough time to execute before the main groutine terminates, then the program will be terminated and no goroutine will run.&lt;br&gt;
You can try this program by commenting  &lt;code&gt;go print()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="n"&gt;Printing&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://play.golang.org/p/okJQ4epTQpx" rel="noopener noreferrer"&gt;Run in Playground&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Channels: In the goroutine code snippet above we used time.sleep to see the difference between how goroutine works, however a better way to do this is by using channels, goroutine actually communicates with each other by channels.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt; &lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Printing from goroutine"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ch&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ch&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;ch&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Printing from main"&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="n"&gt;Printing&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="n"&gt;goroutine&lt;/span&gt;
&lt;span class="n"&gt;Printing&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://play.golang.org/p/zcaqlFu8emv" rel="noopener noreferrer"&gt; Run on Playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the code snippet above, we defined a channel ch on line 13 and on line 14 we call print goroutine passing channel as argument. Our print function receives this channels, prints the &lt;code&gt;Printing from goroutine&lt;/code&gt; and writes true to the channel. When this write is complete, the main goroutine receives the data from the ch channel, till this time our main goroutine was blocked and once it read data from the channel ch, it is unblocked and then the text &lt;code&gt;Printing from main&lt;/code&gt; is printed.&lt;br&gt;
Read more about concurrency &lt;a href="http://www.golangbootcamp.com/book/concurrency" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Concurrency is a property of a program where two or more tasks can be in progress simultaneously. Parallelism is a run-time property where two or more tasks are being executed simultaneously. Through concurrency you want to define a proper structure to your program. Concurrency can use parallelism for getting its job done but remember parallelism is not the ultimate goal of concurrency.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once.&lt;/em&gt; — Rob Pike&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Some Drawbacks Of Golang:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Less Flexibility: Golang has less flexibility than in dynamically typed languages, static typed programming languages like Golang types are checked before runtime while dynamic typed programming languages like JavaSript are checked on the fly during execution.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="s"&gt;"6"&lt;/span&gt;
    &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;6&lt;/span&gt;

    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;n&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//Result&lt;/span&gt;
&lt;span class="o"&gt;./&lt;/span&gt;&lt;span class="n"&gt;prog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;go&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;11&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="m"&gt;19&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;invalid&lt;/span&gt; &lt;span class="n"&gt;operation&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mismatched&lt;/span&gt; &lt;span class="n"&gt;types&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://play.golang.org/p/lSenzovs8b7" rel="noopener noreferrer"&gt;Run in Playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the code snippet above, statically typed languages like Golang would throw an error because they don't allow for type coercion.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;6&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Result&lt;/span&gt;
&lt;span class="mi"&gt;66&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://codesandbox.io/s/distracted-grass-42291?fontsize=14&amp;amp;hidenavigation=1&amp;amp;theme=dark" rel="noopener noreferrer"&gt;Run in Sandbox&lt;/a&gt;&lt;br&gt;
In the  code snippet above, dynamically typed languages like JavaSript would merge the string and the number together.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Smaller Number Of Packages: As compared to other ecosystem like Node.js. This is because Golang's standard is full of features which mostly doesn't need third-party support. However, the number of packages are increasing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In conclusion here are some real world examples of tools and software that uses Golang:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubernates: The Google-backed container platform.&lt;/li&gt;
&lt;li&gt;Drop-box: The cloud storage and file sharing.&lt;/li&gt;
&lt;li&gt;Cloudfare: A content delivery network, DDoS mitigation ans internet security service.&lt;/li&gt;
&lt;li&gt;Malware bytes: An antivirus software.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Part 2
&lt;/h1&gt;
&lt;h3&gt;
  
  
  Installation
&lt;/h3&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%2Fmarcofranssen.nl%2Fimages%2F951957866431d77793480aba8bb624da2f6b3fb2.gif" 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%2Fmarcofranssen.nl%2Fimages%2F951957866431d77793480aba8bb624da2f6b3fb2.gif" alt="Windows"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Installation Of Golang on Windows OS:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;You’ll be completing most of the installation and setup on a command-line interface, which is a non-graphical way to interact with your computer. Make sure  you have an internet connection and administrative access.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Switch to your home directory, for example &lt;code&gt;C:\Users\kenny&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Go installation website &lt;a href="https://golang.org/doc/install" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Download and install the latest 64-bit Go set for Microsoft Windows OS.&lt;/li&gt;
&lt;li&gt;After the installation, run the Command Prompt on your computer &lt;code&gt;go version&lt;/code&gt;.
You should see something similar to this on your command prompt:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Microsoft Windows [Version 10.0.16299.15]
(c) 2017 Microsoft Corporation. All rights reserved.
c:\Users\kenny&amp;gt;go version
go version go1.10 windows/amd64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create your work-space, confirm your Go binaries by 
going to your computer’s Control Panel, then to &lt;code&gt;System and Security &amp;gt; System &amp;gt; Advanced system settings&lt;/code&gt;, and on the left-hand pane click the Advanced tab. Then click on Environmental Variables on the bottom-right-hand side. Ensure Path under System Variables has the “C:\Go\bin” variable in it.
Then create your Go work-space. This will be in a separate and new folder from where the Go installation files are saved. For example, your G installation files were saved under the path &lt;code&gt;C:\Go&lt;/code&gt; and you are creating your Go work-space under &lt;code&gt;C:\Projects\Go&lt;/code&gt;
In your new Go work-space folder, set up three new folders:&lt;/li&gt;
&lt;/ul&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-media-1.freecodecamp.org%2Fimages%2F1%2AI3BO4S6FQ6keH6o75ATuBg.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%2Fcdn-media-1.freecodecamp.org%2Fimages%2F1%2AI3BO4S6FQ6keH6o75ATuBg.png" alt="Folder Creation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create the GOPATH variable and reference your newly-created Go work-space. Go back to your Control Panel and navigate to System and then Environmental Variables. Then under System Variables click on New.
Next to Variable Name, enter &lt;code&gt;GOPATH,&lt;/code&gt; and next to Variable Value enter &lt;code&gt;C:\Projects\Go&lt;/code&gt;.
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-media-1.freecodecamp.org%2Fimages%2F1%2AEdndcOEfhY8DWreAWXjung.png" alt="File path"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Microsoft Windows [Version 10.0.16299.15]
(c) 2017 Microsoft Corporation. All rights reserved.
c:\Users\kenny&amp;gt;echo %GOPATH%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
Check that your path has been set correctly, by entering "echo %GOPATH%" on the command line.




&lt;ul&gt;
&lt;li&gt;Verify that all is working correctly by opening the command line and typing: &lt;code&gt;go get github.com/golang/example/hello&lt;/code&gt;
Wait for the code to be entirely implemented (this could take a few seconds), then enter in the following in the command line: &lt;code&gt;%GOPATH%/bin/hello&lt;/code&gt;
If the installation was successful, you should get the following return message: &lt;code&gt;Hello, Go examples!&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;c:Users\kenny&amp;gt;go get github.com/golang/example/hello
c:Users\kenny&amp;gt;%GOPATH%/bin/hello
Hello, Go examples!
c:\Users\kenny&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;I hope the installation was successful. And if you run into any errors or confusing messages. You can reference &lt;a href="http://www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
Congrats you are now ready to develop in Golang.&lt;/p&gt;
&lt;h4&gt;
  
  
  Installation Of Golang on a Mac OS:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;To download the latest Go release visit &lt;a href="https://golang.org/dl/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. You will see the download link for Apple macOS. The current version of Go 1.13 support macOS 10.10 or later versions with 64-bit support only.
Alternatively, you can download Go 1.13.3 using the curl command line.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl -o golang.pkg https://dl.google.com/go/go1.13.3.darwin-amd64.pkg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;You have downloaded the Go package on your macOS system. To install it simply double click on the downloaded file to start the installation wizard.
Command-line users can execute the below command to start the installation.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo open golang.pkg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Follow the installation wizard and complete the installation process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edit the &lt;code&gt;~/.bash_profile&lt;/code&gt; or &lt;code&gt;~/.profile&lt;/code&gt; file (or its equivalent) to set environment variables. Commonly you need to set 3 environment variables as &lt;code&gt;GOROOT&lt;/code&gt;, &lt;code&gt;GOPATH&lt;/code&gt; and &lt;code&gt;PATH&lt;/code&gt;.
&lt;code&gt;GOROOT&lt;/code&gt; is the location where Go package is installed on your system.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ export GOROOT=/usr/local/go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;GOPATH&lt;/code&gt; is the location of your work directory. For example my project directory is &lt;code&gt;~/Projects/Proj1&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;$ export GOPATH=$HOME/Projects/Proj1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now set the &lt;code&gt;PATH&lt;/code&gt; variable to access go binary system wide.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;govendor&lt;/code&gt; is a tool used for managing the Go application dependencies efficiently. You should consider this to install on your system.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go get -u github.com/kardianos/govendor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally, you have successfully installed and configured go language on your system. First, use the following command to check the installed Go version.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go version

go version go1.13.3 darwin/amd64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope the installation was successful. And if you run into any errors or confusing messages. You can reference &lt;a href="https://medium.com/golang-learn/quick-go-setup-guide-on-mac-os-x-956b327222b8" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
Congrats you are now ready to develop in Golang.&lt;/p&gt;
&lt;h4&gt;
  
  
  Installation Of Golang on Linux OS:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Go &lt;a href="https://golang.org/dl/" rel="noopener noreferrer"&gt;here&lt;/a&gt; and download the latest version of GoLang in an archive file as follows:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/Downloads
$ wget -c https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Next, check the integrity of the tarball by verifying the SHA256 checksum of the archive file &lt;a href="https://www.tecmint.com/generate-verify-check-files-md5-checksum-linux/" rel="noopener noreferrer"&gt;here&lt;/a&gt; using the shasum command as below, where the flag &lt;code&gt;-a&lt;/code&gt; is used to specify the algorithm to be used:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ shasum -a 256 go1.7.3.linux-amd64.tar.gz

ead40e884ad4d6512bcf7b3c7420dd7fa4a96140  go1.7.3.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To show that the contents of the downloaded archive file are the exact copy provided on the GoLang website, the 256-bit hash value generated from the command above as seen in the output should be the same as that provided along with the download link.&lt;/p&gt;

&lt;p&gt;If that is the case, proceed to the next step, otherwise download a new tarball and run the check again.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then extract the tar archive files into &lt;code&gt;/usr/local&lt;/code&gt; directory using the command below.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo tar -C /usr/local -xvzf go1.7.3.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Where, &lt;code&gt;-C&lt;/code&gt; specifies the destination directory..&lt;br&gt;
Configure your environment,  first, setup your Go workspace by creating a directory &lt;code&gt;~/go_projects&lt;/code&gt; which is the root of your workspace. The workspace is made of three directories namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bin&lt;/code&gt; which will contain Go executable binaries.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;src&lt;/code&gt; which will store your source files and&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pkg&lt;/code&gt; which will store package objects.
Therefore create the above directory tree as follows:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir -p ~/go_projects/{bin,src,pkg}
$ cd ~/go_projects
$ ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now it’s time to execute Go like the rest of Linux programs without specifying its absolute path, its installation directory must be stored as one of the values of &lt;a href="https://www.tecmint.com/set-path-variable-linux-permanently/" rel="noopener noreferrer"&gt;$PATH environment variable.&lt;/a&gt;
Now, add &lt;code&gt;/usr/local/go/bin&lt;/code&gt; to the &lt;code&gt;PATH&lt;/code&gt; environment variable by inserting the line below in your &lt;code&gt;/etc/profile&lt;/code&gt; file for a system-wide installation or &lt;code&gt;$HOME/.profile&lt;/code&gt; or &lt;code&gt;$HOME./bash_profile&lt;/code&gt; for user specific installation:
Using your preferred editor, open the appropriate user profile file as per your distribution and add the line below, save the file and exit:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export  PATH=$PATH:/usr/local/go/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Then, set the values of &lt;code&gt;GOPATH&lt;/code&gt; and &lt;code&gt;GOBIN&lt;/code&gt; Go environment variables in your user profile file (&lt;code&gt;~/.profile&lt;/code&gt; or &lt;code&gt;~/bash_profile&lt;/code&gt;) to point to your workspace directory.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export GOPATH="$HOME/go_projects"
export GOBIN="$GOPATH/bin"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;Note: If you installed GoLang in a custom directory other than the default (&lt;code&gt;/usr/local/&lt;/code&gt;), you must specify that directory as the value of &lt;code&gt;GOROOT&lt;/code&gt; variable.&lt;br&gt;
For instance, if you have installed GoLang in home directory, add the lines below to your &lt;code&gt;$HOME/.profile&lt;/code&gt; or &lt;code&gt;$HOME/.bash_profile&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The final step under this section is to effect the changes made to the user profile in the current bash session like so:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ source ~/.bash_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ source ~/.profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally time to verify the installation, Run the commands below to view your Go version and environment:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go version
$ go env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To test your if your Go installation is working correctly, write a small Go hello world program, save the file in &lt;code&gt;~/go_projects/src/hello/&lt;/code&gt; directory. All your GoLang source files must end with the &lt;code&gt;.go&lt;/code&gt; extension.
Begin by creating the hello project directory under &lt;code&gt;~/go_projects/src/&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir -p ~/go_projects/src/hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use your favorite editor to create the &lt;code&gt;hello.go&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ vi ~/go_projects/src/hello/hello.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the lines below in the file, save it and exit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main 

import "fmt"

func main() {
    fmt.Printf("Hello, you have successfully installed GoLang in Linux\n")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, compile the program above as using go install and run it:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go install $GOPATH/src/hello/hello.go
$ $GOBIN/hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To run your Go binary executables like other Linux commands, add &lt;code&gt;$GOBIN&lt;/code&gt; to your &lt;code&gt;$PATH&lt;/code&gt; environment variable.
I hope the installation was successful. 
And if you run into any errors or confusing messages. You can reference &lt;a href="https://www.ostechnix.com/install-go-language-linux/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.
Congrats you are now ready to develop in Golang.&lt;/li&gt;
&lt;/ul&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-media-1.freecodecamp.org%2Fimages%2F1%2Az6i4jwGkvPE3S21x_PmvMw.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%2Fcdn-media-1.freecodecamp.org%2Fimages%2F1%2Az6i4jwGkvPE3S21x_PmvMw.png" alt="Go image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
    </item>
    <item>
      <title>10 Most used Array methods in Javascript</title>
      <dc:creator>ayeolakenny</dc:creator>
      <pubDate>Sat, 13 Jul 2019 01:00:18 +0000</pubDate>
      <link>https://forem.com/ayeolakenny/10-most-used-array-methods-in-javascript-1l41</link>
      <guid>https://forem.com/ayeolakenny/10-most-used-array-methods-in-javascript-1l41</guid>
      <description>&lt;p&gt;In this blog post i'm going to walk you through the most commonly used array JavaScript methods.&lt;br&gt;
Which is going to be helpful in your JavaScript journey, i would also try to keep it nice and simple, so lets dive right in;&lt;/p&gt;
&lt;h2&gt;
  
  
  1. "push();"
&lt;/h2&gt;

&lt;p&gt;This works at the ending of an array, &lt;br&gt;
which helps in adding elements to the end of an array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that the letter 'd' has been pushed(added) to the end of the array,&lt;br&gt;
and it makes permanent change to the array.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;&lt;span class="c1"&gt;//returns the new value of the array (4)&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//returns ['a', 'b', 'c', 'd']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. The "pop();"
&lt;/h2&gt;

&lt;p&gt;Like the "push" method mentioned above.&lt;br&gt;
the "pop" method also works at the ending of an array, &lt;br&gt;
which helps in removing elements at the end of the array, and returns the element.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice the the letter 'd' has been popped(removed) out of the end of the array,&lt;br&gt;
and it makes permanent change to the array.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;//returns 'd'&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//returns  ['a', 'b', 'c']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. "shift();"
&lt;/h2&gt;

&lt;p&gt;This works at the beginning of an array, &lt;br&gt;
which helps in removing elements from the beginning of the array, and returns the element.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice the the letter 'a' has been shifted(removed) out of the end of the array,&lt;br&gt;
and it makes permanent change to the array.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;//returns 'a'&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//returns  ['b', 'c', 'd']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. "unshift();"
&lt;/h2&gt;

&lt;p&gt;You guessed right, this is the opposite of the "shift()" method,&lt;br&gt;
 it also works at the beginning of an array, and helps in adding elements to the beginning an array, &lt;br&gt;
and returns the length of the array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that the letter 'a' has been unshifted(added) to the brginning of the array,&lt;br&gt;
and it makes permanent change to the array.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unshift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;&lt;span class="c1"&gt;//returns the new value of the array (4)&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;//returns ['a', 'b', 'c']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. "concat();"
&lt;/h2&gt;

&lt;p&gt;This helps to concatenate(join/link) two arrays together.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that the first array(arr) and the second array(arr2) has been concatenated(joined) together,&lt;br&gt;
and moreover the "concat" method does not make any change to the array.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;//first array&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arr2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;//second array&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;concat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;&lt;span class="c1"&gt;//returns ["a", "b", "c", "d", true, false, true]&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//returns ['a', 'b', 'c', 'd']&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;arr2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//returns[true, false, true]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. "join();"
&lt;/h2&gt;

&lt;p&gt;This joins all the elements in an array to create a string, and does not affect or modify the array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that the "join" method takes an element and outputs it inbetween the strings.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&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="p"&gt;));&lt;/span&gt;&lt;span class="c1"&gt;//returns 'abcd'&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;arr&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="s1"&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;//returns 'a-b-c-d'&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;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;//returns ['a', 'b', 'c', 'd']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. "reverse();"
&lt;/h2&gt;

&lt;p&gt;This basically takes in an array, and reverses it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that it makes a permanent change to the array.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&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="c1"&gt;//returns ['d', 'c', 'b', 'a']&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//returns ['d', 'c', 'b', 'a']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. "sort();"
&lt;/h2&gt;

&lt;p&gt;This basically helps in sorting arrays to order, however causing permanent change to the array.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that it sorts the numbers before the alphabets.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&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;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="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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;();)&lt;/span&gt;&lt;span class="c1"&gt;//returns [1, 2, 3, 4, 5, 'a', 'b', 'c']&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;arr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;span class="c1"&gt;//returns [1, 2, 3, 4, 5, 'a', 'b', 'c']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. "slice();"
&lt;/h2&gt;

&lt;p&gt;This basically targets an array and returns the targeted array,&lt;br&gt;
and the original array remains unchanged.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Notice that the value is returned from the first value((1)=b) of the array and one element aback from the second value ((2)=b) of the array,&lt;br&gt;
and the original array remains unchanged.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slice&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="c1"&gt;//returns ['b']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  10 "splice();"
&lt;/h1&gt;

&lt;p&gt;Just like the "slice();" method, this also targets an array and returns the targeted array,&lt;br&gt;
moreover it causes a permanent change in the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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;arr&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="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&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="c1"&gt;//returns ['a', 'b', 'c']&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;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;//returns [1, 2, 3, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Notice that the value is returned from the first value((5)='a') which states the element to start from,&lt;br&gt;
and the second value(3) which states the number of elements to be removed from the array.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-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;arr&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="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&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;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;replaced&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;&lt;span class="c1"&gt;//returns ['a', 'b', 'c']&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;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;//returns [1, 2, 3, 4, 5, 'replaced']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Notice that you can also replace a spliced element with another element by adding the element in the third argument.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Thats the 10 most common/used array methods i think all javascript programmers must learn, if you have any to add feel free to add below.&lt;/p&gt;

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