<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sabina S Ohlsen on Medium]]></title>
        <description><![CDATA[Stories by Sabina S Ohlsen on Medium]]></description>
        <link>https://medium.com/@saohlsen?source=rss-93ccbc7e4503------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_ULPbhqJ3wM7bqjtrdxVng.jpeg</url>
            <title>Stories by Sabina S Ohlsen on Medium</title>
            <link>https://medium.com/@saohlsen?source=rss-93ccbc7e4503------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 02:31:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saohlsen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understand SQL]]></title>
            <link>https://medium.com/@saohlsen/understand-sql-e04afcb315ef?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/e04afcb315ef</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 00:45:14 GMT</pubDate>
            <atom:updated>2020-09-14T00:45:14.686Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*eO7qtqUrNlHDPWhZM9lKfA.jpeg" /></figure><p>With today’s technology, we have so many ways to access information. We also have so many different tools on the Internat that we can access and participate with. That information is stored somewhere in an organized way. The storage of information or data is a database. It is controlled by DBMS — database management system and most of the database is structured with query language (SQL).</p><p>It’s a standard language for relationship databases, and what it does is to manage and keep in an organized way, different systems.</p><p>Language allows to create, update data, or retrieve relational data form databases. The fact is that you can manipulate data. SQL became very important in 1970 and still is today, where relational data is very important in data science. There are four types of databases: desktop data, text, relational (RDMS), NoSQL and object orientated. Today we will learn main concepts of the database.</p><h4>1. Data Types in SQL.</h4><p><strong><em>Characters</em></strong><em>: </em>CHAR(n) — fixed length string data and VARCHAR(n) — variable length string data.</p><p><strong><em>Numbers</em></strong><em>: </em>biting, int, smallint, tinyint, float, money.</p><p><strong><em>Times and data</em></strong><em>: </em>Data and Datatime.</p><h4>2. Tables</h4><p>Tables are main elements of database, they are objects that contain data in the database. A tuple in a table is also called a rows or record, and table is a set of tuples, like an unordered list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*584jchkRwGwagHKropeKgA.png" /></figure><h4>3. Keys</h4><p>Their role is to uniquely identify any row inside the table. It helps to identify relationship between different tables. Keys in SQL are sets of attributes that help to identify a row (tuple) and relationship(table). There are different types of keys.</p><ul><li>Super key — identifies rows in the table.</li><li>Primary Key — is a column or group of columns in a table that uniquely identify every row in that table.</li><li>Candidate Key — is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes and can work as a Primary key.</li><li>Alternate Key — set of one or more columns or group of columns in a table that uniquely identify every row in that database.</li><li>Foreign Key — is a primary key in another table and creates a unique relationship between two tables. Helps to navigate between two different instances of an entity.</li><li>Compound/Composite Key — has two or more attributes that allow you to uniquely recognize a specific record. It is possible that each column may not be unique by itself within the database.</li><li>Surrogate Key — An artificial key which aims to uniquely identify each record is called a surrogate key. These kind of keys are unique because they are created when you don’t have any natural primary keys</li></ul><h4>4. Select Queries.</h4><p>Selects and returns data stored in one table or more tables. Also, it selects from other queries. Helps to access data much faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*RAp0Oj_c6RGxGZWlp6rRmQ.png" /></figure><h4>5. Joins</h4><p>So tables are structured with primary keys and linked with foreign keys and can be displayed with select queries. With join concept we can access and display data from multiple tables simultaneously by connecting them. We can then summarize and analyze for particular needs. To join two or more tables you can use id; we have different times of joins:</p><ul><li>inner — contains only data from tables that match.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/0*6vr76Mbk8VjYiivf.png" /></figure><ul><li>left outer — contains all data from the first referenced table and only retrieves data from the other table that matches.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/0*LdMKUszodoeWdYjJ.png" /></figure><ul><li>right outer — contains all data from the second referenced table and only gets data from the first table that matches.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/0*1Ns6EfGVbOK4LmQE.png" /></figure><ul><li>full outer — contains data from both tables that are opposite to each other and data is joined.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/0*6VClXlYTG8OEDZJs.png" /></figure><h4>6. Data Modeling</h4><p>With modeling data we can see the relationship between tables. Following relationships are:</p><ul><li>one-to-one — one data from one table is referenced to one data from other table.</li><li>one-to-many — unique data from one table is related to the table that has multiple data values in the other table.</li><li>many-to-many — there is no unique ID’s used in this relationship. Multiple rows in one table are related to multiple rows in the other table. An example would be when student that is enrolled in multiple classes and class has many students.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*8wgSwrGlHpnfkdso6HjnAQ.jpeg" /></figure><p>Personally, I find SQL a fascinating subject with so much more to offer. Considering how important data is nowadays, some may argue that is the most valuable commodity, diffrent form what we used to, oil, grain or coffee are something tangible that everyone can relate and understand. Data on the other hand not everyone can relate or has interest but it effects our day to day life more than ever even if we not aware of it, every-time we swipe a credit card or search the internet, we are giving away our interest to someone. It is fascinating but can also be scary at the same time.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e04afcb315ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things you need to know about Express.]]></title>
            <link>https://medium.com/@saohlsen/things-you-need-to-know-about-express-5a4a11a09e92?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a4a11a09e92</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Sun, 06 Sep 2020 23:17:14 GMT</pubDate>
            <atom:updated>2020-09-06T23:19:35.310Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Dno6e7KS5HcdGybg9A0onQ.png" /></figure><p>As you are building your toolbox with new tools, learning new concepts can be intimidating yet exciting. Today I will introduce Express, which is a Node.js Web Framework.</p><p>Its is an open source, free, fast, un-opinionated and you have full control of how you will send a request to the server. Express is a server side or back-end framework and it is used with a combination of other front end frameworks.</p><p>There are many reasons why we would like to use Express. It makes building Web application with Node.js mush easier and we maintain full control how requests will be sent to the server. We will learn what are the methods we can use, what are the routs and middleware.</p><h4>Syntax</h4><p>Below is a module syntax to bring express; the other way would be to use babel to compile it. To initialize, you just assign express method to a variable.</p><p>Next, you create endpoints, <em>get</em> request, you accepting a get request to an index route (/), and then we accept a callback function which accepts a request and response (req, res). Inside the function we do whatever we need to. In this case we are suspending with the text of Good day.</p><p>And of course, we have to listen on the port, here we listen on 5000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*43rSX8v3mr0LJi_1TAwTyw.png" /></figure><h4>Methods</h4><p>For each HTTP verb there is a method like: <em>get(), post(), put(), delete(), patch()</em>. Callback methods is passed and is called when a request starts.</p><p><em>app.method(path, handlaer)</em></p><ul><li>app is an instance of express</li><li>method is an HTTP request method</li><li>path represents a path on the server</li><li>handler is the function executed when the route is made</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2N9harqZYB6T_ByHA1maZw.png" /></figure><h4>What are Routs Requests ?</h4><p>With routs, you can fetch data form your database like MongoDB or mySQL; you can load pages, return JSON data. Requests and response objects are very important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YWsVPSE-OeY0ldsmwaR5yg.jpeg" /></figure><p>Request object represents http request properties for things like url parameters, query strings, any data that is sent through body, http headers. You can also create middleware, which are things that you can change or add things to the object.</p><p>Response object represents http response, and it’s up to us to use this object to send back JSON data or raider a template, or redirect. They’re many things you can do with that object. You can also redirect using res.redirect(). Data can be parsed with body parser which is also included in express.</p><h4>Middlware</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iAbSXX2UYV2mb70QeoL_GA.png" /></figure><p>Let’s look at above example, to call middleware function, we use <em>app.use() </em>and pass the name of the function.</p><p>In the above example, we pass <em>myMiddlware</em> and it is important to invoke before the root path <em>(/)</em>.</p><p>Whenever the request is made, ‘<em>input’</em> will be printed in the terminal. We must remember about execution order; middleware loads first and is executed first. Otherwise, the request will never be reached and nothing would print on console. The correct way is that middleware is executed first and it passes the order to the next function in the stack by invoking <em>next()</em> function.</p><p>As you can see this is another powerful tool which helps to create web applications with Node.js in much easier fashion. It is also great to use with client side framework as it its all Javascript.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a4a11a09e92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to node.js ?]]></title>
            <link>https://medium.com/@saohlsen/introduction-to-node-js-4222669a9cf7?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/4222669a9cf7</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Mon, 31 Aug 2020 00:30:12 GMT</pubDate>
            <atom:updated>2020-09-01T19:13:04.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*AY14BnNy-j9vUeSjh4THHQ.png" /></figure><h3><strong>Introduction to node.js</strong></h3><p>Not too long ago, JavaScript code could only be executed on the browser. As Javascript evolved through the years and became a more powerful language, it was still only used as a front end language, and the other languages had to be used for the back end side. But thank to Node.js which was invented in 2009, by Ryan Dahl; it quickly received a wide range of interest and it is currently still popular. Node.js is used by top companies like: Netflix, Uber or eBay.</p><p>Node.js an asynchronous event-driven JavaScript runtime. But what does this exactly mean? JavaScript and Node.js run on the V8 Javascript runtime engine. It converts code as it is run. It forms high-level code and compiles to faster machine process where computer can execute without interpreting.</p><h4>What is Node REPL</h4><p>Abbreviation stands for ReadEvalPrintLoop, it means that Node.js is a program that cycles between different states. REPL comes in the package when Node.js is downloaded.</p><p>Read: as name indicated it a stated where it reads the input.</p><p>Eval: where the input is evaluated.</p><p>Print: evaluation is printed.</p><p>Loop: process of looping.</p><h4>Running a Program with Node</h4><p>Instead of using <em>console.log</em> in a browser you can run JavaScript on computer, as below example shows, you can type in your terminal <em>node</em> and name of the file you need, in this case is <em>App.js</em> and the outcome will be <em>Hello World.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b06689cfc8b4fd1c6692a244d9ef426d/href">https://medium.com/media/b06689cfc8b4fd1c6692a244d9ef426d/href</a></iframe><h4><em>Modularity</em></h4><p>Is a technique where diffrent parts of a program are in their individual files instead of in one huge file where code may become confusing, and when they come together they create one cohesive unit. All those parts are combined together using <em>require()</em> function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba023e4115708ae7c74b2ad905943d7e/href">https://medium.com/media/ba023e4115708ae7c74b2ad905943d7e/href</a></iframe><p>In above example we will take a look at two files <em>week</em>.<em>js</em> and <em>app.js. </em>In <em>week.js</em> we are adding <em>Week</em> class a value of module exports. If you wonder what that is, I will tell you it is an object that exists in every Node environment. What this object does is that it holds the content of that file, and it can be required to a diffrent file. So, if you look on line thirteen, in <em>app.js,</em> we have assigned variable <em>Week</em> to the <em>module.exports </em>object of<em> week.js </em>file by invoking the<em> require(). </em>In function, we pass the path to the module; in this case it is <em>(‘./week.js’)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBjzzfc675T_vUMtOcbIuA.png" /></figure><h4>Node Package Manager</h4><p>NPM organizes modules so they can be easy found by Node, which also manages dependencies. NPM itself consists of three components: website, registry and CLI. You can locally install your npm, by running the below command. One popular package is <em>nodemon. It is </em>very useful tool the watches all the files in the project you working on and resets every time you make changes in the file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d958b9eea9d99ffaa8cb507a2b50ff2b/href">https://medium.com/media/d958b9eea9d99ffaa8cb507a2b50ff2b/href</a></iframe><p>When npm is installed you will have <em>node_modules </em>and <em>package.json </em>in your folder.<em> </em>Below is an example how package.json looks like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4cd9a04599e7641ee1dc31246d71d79/href">https://medium.com/media/d4cd9a04599e7641ee1dc31246d71d79/href</a></iframe><h4>Event-Driven Architecture</h4><p>We often hear that Node is event driven. What does this exactly mean? Node facilitates EventEmitter module that communicates between objects in Node. We can access events using requiring.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf1c9cd3238d04755a72ed9a907e1060/href">https://medium.com/media/bf1c9cd3238d04755a72ed9a907e1060/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*D3EGOJTLE0znXZlL_jY0Jw.jpeg" /></figure><p>As you can see, it seems that Node.js is one very powerful tool with a very rich ecosystem, ready to use and to create. And can be used to build many different things like:</p><p>SPAs, single page apps, due to its asynchronous data flow and event loop it captures simultaneously user’s requests and updates.</p><p>RTAs, real-time app, like Google Doc, Slack are also asynchronies event-driven which play huge roles.</p><p>Node.js is a very powerful tool and it is not going anywhere, considering it is still very popular.</p><p>Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4222669a9cf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to JavaScript Promises.]]></title>
            <link>https://medium.com/@saohlsen/introduction-to-javascript-promises-e478cdf3f55?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/e478cdf3f55</guid>
            <category><![CDATA[promises]]></category>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Mon, 24 Aug 2020 01:45:43 GMT</pubDate>
            <atom:updated>2020-08-24T01:45:43.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qM-qv01DvIOSQpTnOdFsGg.jpeg" /></figure><p>In JavaScript, among many ES6 features like template literal, deconstructing, or arrow functions we were introduced to Promises. Some love them and some not so much. Promises are designed to support asynchronous programming and they simply replace callbacks functions. As a result, asynchronous programming is simplified and visually not only looks more attractive to an eye but also is much more efficient. In today’s blog, we will learn what is Promise, what are the states Promise can take, how Promise is created, and what methods we can use when creating Promise.</p><p>What is Promise? It is an object that is a placeholder for future value, with possible three outcomes of an asynchronous execution.</p><p>What are the three states Promise can be in:</p><p>Pending: in these state when Promise is not completed yet, first state.</p><p>Fulfilled: in this state Promise has been successfully completed. Promise has value of resolved.</p><p>Rejected: these sate happens when operation failed. The outcome of this operation will result with an Error, indicating the rejection.</p><p>Correct terminology for fulfilled Promise is <em>settled</em>, moment when Promise is delivered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*Ylt33E2Kg_nlstiOMjUHXA.png" /></figure><p>Let’s think of real-life example, think of doing the laundry. What will be a <em>pending, fulfilled </em>or <em>rejected </em>state of actions. Lets break it down:</p><p><em>Pending</em>: would be while your machine is on and running but not yet finished.</p><p><em>Rejected</em>: would be while we encounter some sort of issue, like you did not put any detergent, and in the end the cloths are still dirty. The entire operation will have to be repeated.</p><p><em>Fulfilled </em>— when everything went as planed and cloths are clean after action is completed.</p><p>How do we create and Promise?</p><p>As mentioned earlier a Promise is an object, and to create a Promise object we will use <em>new</em> keyword and the Promise constructor method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a36b5457515590462aa1cfbb6abca08/href">https://medium.com/media/6a36b5457515590462aa1cfbb6abca08/href</a></iframe><p>In Promise constructor method takes a function as its only parameter function myFunc, this function runs automatically when constructor is invoked.</p><p>The above example myFunc takes two parameters:</p><p><em>resolve</em> is a function that takes one argument, this function will change a Promise status.</p><p><em>reject </em>is a function that takes reason or an error as an argument. This function will change status of the Promise from pending to reject, and the reason will be set to the argument passed into <em>reject().</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44a30e8bd90626bcc6cc66b7993af14b/href">https://medium.com/media/44a30e8bd90626bcc6cc66b7993af14b/href</a></iframe><p>Let’s deconstruct above code example, first <em>newPromise</em> that is constructed as a <em>new</em> <em>Promise;</em> which essentially is the Promise constructed method.</p><p><em>myFunc()</em> is passed to the constructor and performs two functions as parameter: <em>resolved and reject</em>.</p><p>When condition is evaluated to <em>true</em>, then <em>resolve()</em> function is invoked <em>‘Cindy passed the exam!’</em></p><p>But when condition evaluates to <em>false</em>, then <em>reject()</em> function gets invoked ‘<em>Cindy failed the exam.’</em></p><p>Let’s look at another example to see <strong>pending</strong> status of the Promise. For this example we will wrap the code of the executor in the setTimeout() function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/171c597075cdb491045b2e7e0ddf787e/href">https://medium.com/media/171c597075cdb491045b2e7e0ddf787e/href</a></iframe><p>In this example we start the Promise at pending state. Its value is equal to undefined and the Promise value will return after Promise is completed. And after it is completed, value will change from pending to completed.</p><p>But if we change value of variable reading form true to false, Promise gets rejected after 5 seconds, the state of the Promise changes from pending to rejected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*D9vkEr8QlUInCjIw5lWWkQ.png" /></figure><p>For Promise objects with pending status, we need to schedule a callback function. When Promise is ready, it will be resolved or rejected. We can to that with the Promise methods: then() and catch().</p><p>then() — is used when Promise is successful, it takes two callback functions. They are called handler. The first handler will be called when promise is resolved and second handler when Promise is rejected.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/077d7c4541a49cf51c24ae37ce39940a/href">https://medium.com/media/077d7c4541a49cf51c24ae37ce39940a/href</a></iframe><p>catch() — this method is handling the rejection, as you can see in above example, second handler is handling rejection, but .catch() is another way to do the same.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e64de761696bbbbbf66530afbd63ad32/href">https://medium.com/media/e64de761696bbbbbf66530afbd63ad32/href</a></iframe><p>In this short introduction to Promises you can get a feeling how much more flexible you can be and improve your asynchronous code and have better control flow. No more nested callback function, your code is much more attractive, easy to read, and efficient.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e478cdf3f55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MERN in action.]]></title>
            <link>https://medium.com/@saohlsen/mern-in-action-e10ba1d7cb73?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/e10ba1d7cb73</guid>
            <category><![CDATA[mern-stack]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Mon, 27 Jul 2020 03:03:03 GMT</pubDate>
            <atom:updated>2020-07-27T03:03:03.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fB1VDSXLPFgncHn-xnr2Zg.jpeg" /></figure><p>As a user of many applications, we constantly feel hungry for more. The moment we get introduced to a new application we feel happy an excited; but that moment lasts for very short period of time. Quickly we learn and see how it could be improved or a new feature added. It’s like buying a kid a new toy. It may interest them for some time but then the toy is in the corner and they seek for something new. We are just like that with technology, our inner child is always seeking for something new, better, or exciting.</p><p>But from a developer’s viewpoint, perspective is similar but different at the same time. A developer understands the “ins and outs” or limitations at the moment which can be challenging to meet certain requirements. But this inner child of the developer is also alive and seeking for new solutions to satisfy the user side component. Which obviously, developer is often both the user and the developer at the same time.</p><p>Recently, I was introduced to new concept in programming called MERN Stack technology. It’s a cool and easy term to remember for a start, but its not only just that. Behind this short abbreviation, we have many more important terminologies. MERN is a set of frameworks, which is used by developers to create new applications. Let’s quickly refresh what is a framework. As we know in order to develop an application, we need a framework. The framework is a main tool or platform that provides basic foundation where programs can be built. Frameworks are versatile, robust, and efficient.</p><p>So stack technology offers a set of framework that are used in development of new applications. Most known sets of framework I came across are:</p><p><em>MERN (MongoDB, ExpressJS, ReactJS, NodeJS)</em></p><p><em>LAMP (Linux, Apache, MySQL, PHP)</em></p><p><em>MEAN (MongoDB, ExpressJS, AngularJS, NodeJS)</em></p><p>Today, I will talk about MERN Stack. As you noticed, it consists of the following components: MongoDB, ExpressJS, ReactJS and NodeJS and together they create the web development framework.</p><p>Let’s look closer at what each component of this MERN Stack technology is responsible for:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*JA_nYrIIDEToM4zibrS0Mw.png" /></figure><h4>MongoDB</h4><p>Is an open-source, cross platform with following characteristics:</p><p>· Document Orientated and NoSQL database — data is saved as collection and documents, which makes faster integration of data.</p><p>· Sharding — improves in horizontal scalability and allows to store large volume of data.</p><p>· Indexing — any field can be indexed.</p><p>· Schema Less — flexibility with data structure</p><h4>ExpressJS</h4><p>Lightweight framework that is layered on top of NodeJS and helps to build backend of an application using NodeJS functionality. ExpressJS complements NodeJS in creations of web applications.</p><h4>ReactJS</h4><p>Front-end framework. It is JavaScript library crated by Facebook, used to build user interface of a single web page application as well as mobile application. React supports UI components that are used to represent different elements, each component has its logic, because of those components with React you can design simple and flexible user interface.</p><p>Typical react application looks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*qUcIwFGvdOwQ91iq-yH_yw.png" /></figure><h4>NodeJS</h4><p>It is a run time environment, and has a single threaded nature where processes of many parts of a program are executed a the same time. It was built to run Javascript on a machine rather than browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCWe8XF98OsZSHIHLrSD8A.png" /></figure><p>MERN Stack technology among many others is a great way to deliver new applications that satisfy needs of users and challenge and help to grow developers to become better every day. Both user and developer, as a cohesive whole, drive technology forward, day after day, month after month, year after year. We can see how far we have come, but also speculate how much further we can go. For someone like myself, slowly shifting from user to future developer new concepts, terminology, frameworks are thrown at me. I feel like bucket of water is poured on me, but in reality, it’s just few drops.</p><p>Thank You for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e10ba1d7cb73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transpiler: bridge to the modern code.]]></title>
            <link>https://medium.com/@saohlsen/transpiler-bridge-to-the-modern-code-bd8b1257a481?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd8b1257a481</guid>
            <category><![CDATA[transpilers]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Sun, 19 Jul 2020 23:50:07 GMT</pubDate>
            <atom:updated>2020-07-19T23:50:07.043Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BjWDQGGoztjzdIdwLU5bOg.jpeg" /></figure><h3><strong>Transpiler </strong>bridge to the modern code.</h3><p>Learning a new programming language in of itself is challenging, but it is only the stepping stone into the programming world. There are so many different aspects of technology that one must get familiar with in order to stay in the game. Let’s consider the different operating systems, different software, terminals, and not to mention other languages. Among different concepts thrown, there is one often heard — transplier.</p><p>Two terms that create some confusion are transpiling and compiling. Compling refers to an action of taking a source code form one language and converting it to another. Whereas transpiling does the same thing as long as languages have similar level of abstraction.</p><p>And now…what does a level of abstraction mean?</p><p>It refers that all code in a given section is at the same level. As an example, we cannot transpile C# into IL as they are totally different languages. The proper term would be to compile.</p><p>But when we convert TypeScript into Javasctipt the better term for this action would be that we are transpiling as both are on a similar level of abstraction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*8u_O5jSiksOM056G6a2X-Q.png" /></figure><p>Lets look closer into Transpiler, and when we would need to use it?</p><p>If you challenge yourself to learn Javascript, you most likely came across that there is a difference in each version of Javascript, like ES5 and ES6. But again it is the same language, so why use transpiler we ask. And that is a very valid question. We have to remember that not all browsers support the newest versions of a language. Many do, but there are still some that do not. For that reason we would use transpiler to translate ES6 code to ES5 or even ES4 or ES3.</p><p>Let’s look at this simple example and see how this will this look in actual code in ES6 and after we use transpiler.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9e7a91109e20dae307108bf1f889e11/href">https://medium.com/media/b9e7a91109e20dae307108bf1f889e11/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b20818399a565cb727b6104821ba8631/href">https://medium.com/media/b20818399a565cb727b6104821ba8631/href</a></iframe><p>Most popular transpiler is Babel. What is it and why do we need it?</p><p>As you noticed while learning Javsacript that there are so many new features that came with ES6 version like promises, arrow functions, spread operator, or classes and many more. And most likely newer features will be introduced in upcoming years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*q_UQw4hSrUE83fPpsxv6IQ.png" /></figure><p>It is a tool that allows you to write advanced Javascript codes and Babel will convert code to be readable in all browsers. Therefore, it is a Javascript transpiler that converts Javascript into ES5 and will run in all browsers.</p><p>Browsers do their best to keep up; but they are not perfect. This is why Babel is very powerful and needed. It takes modern Javascript and forms that can be understood in different environments. You can install by running below code and save as a dependencies. Additionally, you will need presets which may vary depending on you project needs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c43b27932e801b93a9e0e5d00a556e5/href">https://medium.com/media/2c43b27932e801b93a9e0e5d00a556e5/href</a></iframe><p>We often hear that technology is moving fast. Is it really technology or that humans want to move fast? I believe we really do want to move fast. We constantly improve, build, and look to implement new features. Technology that was created before must be maintained. Therefore tools like transpilers are the solution to link both. To any developer having transplier allows them to be able to be modern in their code.</p><p>For as long as Javascript will continue to be the most popular programing language and as it evolves, we need transpiler. Until then, it is not going anywhere. We can’t have new features of ECMAScript without transpliers.</p><p>In conclusion, I would like to cite an editor of the ECMAScript standard, Brian Terlson, a senior program manager on the Microsoft Edge team. Brian said “Transpilers are hugely important. JavaScript programmers generally want to use the latest features. Catering to the lowest common denominator is miserable, and no one wants to do it. What transpilers let you do is write code in that fancy new syntax that you love, that makes you productive, that makes your app maintainable — and compile it down to something that runs on old crusty browsers you wish didn’t exist in the marketplace but unfortunately do. Transpilers have been transformative in how the JavaScript community writes code.”</p><p>Thank You for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd8b1257a481" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic concepts of AngularJS.]]></title>
            <link>https://medium.com/@saohlsen/basic-concepts-of-angularjs-9028a7e332a?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/9028a7e332a</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[angularjs]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Mon, 13 Jul 2020 02:15:06 GMT</pubDate>
            <atom:updated>2020-07-13T02:15:06.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*XbVDRX6FtjXKFLIvzm4mlA.jpeg" /></figure><p>AngularJS is one of the most popular web application frameworks. But what it is a framework? Well…a framework is a platform in which programmers can create and develop applications. Some frameworks can include libraries with codes, compilers, or some other programs. Therefore, AngularJS is an example of a structural framework, it provides structure for creating dynamic web applications. With HTML we can create application components that are very well organized. With data bindings and dependencies we can reduce and maximize efficiency of the code we write.</p><p>What are the very basics you need to know about AngularJS if you are beginner like me? Lets look into: model, controller, routing and view.</p><h4>Model — represents data.</h4><p>Model is a very basic concept of this framework, and can represent anything: controllers, services, etc. But the application itself is a main model, and syntax is:</p><pre>&lt;body data-ng-app=&quot;AngularApp&quot;&gt;</pre><p>It represents method of the main model which belongs to global object angular. The name of the module is a first parameter and the second parameter represent a list of models in which belongs to each model.</p><p>The main model is always linked to the HTML body element. And in this way we are informing AngularJS that whatever is in the body element, this is our application.</p><pre>&lt;body data-ng-app=&quot;AngularApp&quot;&gt;</pre><h4>Controller — connects/binds Model and View</h4><p>Controllers, like its name suggests, monitors functionality and it is responsible to access data and empower the model. To access the model it is the same way as when we are declaring, but without the list. We invoke the controller function which takes first the parameter, the name of the controller and the second callback function. That function takes a <em>$scope</em> as a parameter. It represents variable which represents something as a model. Its properties can be binded later in view. Below you can see two properties <em>greeting </em>and <em>students</em>; they can be connected to view. However, before we continue, let’s talk about one more important topic to AngularJS — <em>routing</em>.</p><pre>angular.module(&#39;AngularApp&#39;).controller(&#39;appController&#39;, function ($scope){<br>$scope.greeting = &#39;Hello Everyone!&#39;;<br>$scope.students = [<br>  {<br>  firstName: &#39;Jaz&#39;,<br>  lastName: &#39;Thomson&#39;<br>  },<br>  {<br>  firstName: &#39;James&#39;&#39;,<br>  lastName: &#39;Brown&#39;<br>  },<br> ];<br>});</pre><h4>Routing — represents a selections path.</h4><p>What routing does is moving from one view to another. This allows to create single page application but with multiple contents; where you can move depending on which route is chosen. We specify route in URL after ‘#’ sign.</p><p>There are two routings in below examples:</p><p><a href="http://…./#/"><em>‘http://…./#/</em></a><em>’</em> — it is hold in example.html file and can be connected with ‘appController’</p><p><a href="http://…/#/ students&#39;"><em>‘http://…/#/ students</em></a><em>’ </em>— next is within address of students.html file and it will connect with the same controller ‘appController’.</p><pre>angular.module(&#39;AngularApp&#39;).config([&#39;$routeProvider&#39;,<br>  function($routeProvider) {<br>    $routeProvider<br>      .when(&#39;/&#39;, {<br>        templateUrl: &#39;example.html&#39;,<br>        controller: &#39;appController&#39;<br>      }, null)<br>      .when(&#39;/students&#39;, {<br>        templateUrl: &#39;students.html&#39;,<br>        controller: &#39;appController&#39;<br>      }, null);<br>}]);</pre><h4>View — that is what people see.</h4><p>How and what we did above is connected to the View, which is the last and main component.</p><p>Before we connect file <em>student.html</em> to the same controller as example.html, and what is contained in <em>example.htlm</em> we see in div element by addressing <em>‘appController’</em> in attribute <em>data-ng-controller</em>.</p><p>Next line exemplifies binding of model in view, as variable scope was assigned to greetings, and we can link to the second variable defined before and displays the value.</p><pre>&lt;div data-ng-controller=&quot;&#39;appController&#39;&quot;&gt;<br>  &lt;p&gt;&lt;/p&gt;<br>  &lt;a href=&quot;/AngularApp/#students&quot;&gt;Student list&lt;/a&gt;<br>&lt;/div&gt;</pre><p>Let’s take a look at students.html; we can now see how to iterate through all elements of an array by (<em>data-ng-repeat</em>). We can access an actual element iteration; actual element is in variable item.</p><p>Next, we can connect variable with text by using attribute <em>data-ng-model</em>; when user changing text filed, model variable will be automatically actualized and visible wherever there is binding.</p><pre>&lt;div data-ng-controller=&quot;appController&quot;&gt;<br>  &lt;div data-ng-repeat=&quot;item in students&quot;&gt;<br>     &lt;h4&gt;User:&lt;/h4&gt;<br>     &lt;p&gt;Fist name: &lt;/p&gt;<br>     &lt;p&gt;Last name: &lt;/p&gt;<br>&lt;p&gt;Change last name: &lt;input type=&quot;text&quot; data-ng-model=&quot;item.lastName&quot;&gt;&lt;/p&gt;<br>  &lt;/div&gt;<br>  &lt;a href=&quot;/AngularApp/#/&quot;&gt;Go back&lt;/a&gt;<br>&lt;/div&gt;</pre><p>To learn angular, the best approach is to really understand the fundamental principle. Memorizing or trying to mimic a code will not help, as every application might be different. However, once the main concepts and terminology are understood; you can apply to your needs as you go through your carrier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*QUB2pTRVCy2mRxIXep9NNw.jpeg" /></figure><p>In addition, if you’re a novice like I am trying to understand concepts, you may feel intimidated with new terminology and everything may seem difficult and chaotic. It is at the time to allow yourself to step back; and with time, the terminology will become another set of words in your daily dictionary.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9028a7e332a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ES6 Modern way to write code.]]></title>
            <link>https://medium.com/@saohlsen/es6-modern-way-to-write-code-a82fc6547019?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/a82fc6547019</guid>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[begginer]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Mon, 06 Jul 2020 04:23:27 GMT</pubDate>
            <atom:updated>2020-07-06T04:23:27.984Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7W7vuLzSZYCIWbTv8DfJUw.jpeg" /></figure><p>ECMAScript is a standardized name for Javascript, ES6 is the latest and 6th version for the programming language. It was published in June 2015. Until then, the 5th version was available which was published around 2011. The ES5 version is supported by all browsers, however thee ES6 is not currently supported by all browsers. In the meantime, a common option is to use a transpiler that can convert ES6 to ES5. Some questions to ask. What are the differences? What are the pros and cons of each? Let’s consider some examples and we can evaluate their characteristics.</p><p>Today, I will mention six basic ES6 features:</p><p>Var, Let, and Const Declaration</p><p>Arrow Function Parameters</p><p>Default Parameters</p><p>String Templating</p><p>Spread operator</p><p>Promises</p><p><strong>Var, Let, and Const Declaration</strong></p><p>In ES6, variable declared with keyword var is big no, no, this declaration is known for ES5. Var has function scope if declared inside of the function body, or global if declared outside.</p><p>Where in ES6, we have new keywords for variable declaration: const and let.</p><p>Variables declared with const can not be changed. But, if that is not what you want; another option is to use let which has different behavior and has block scope. This means the value of the variable will exist until the end of the scope is declared.</p><pre>//ES5<br>function print() {<br>  console.log(i);        // Due to hoisting i is undefined<br>  console.log(j);        // ReferenceError: j is not defined</pre><pre>for( var i = 0; i &lt; 4; i++ ) {<br>  console.log(i); // 0, 1, 2, 3<br>};</pre><pre>//ES6<br>for( let j = 0; j &lt; 4; j++ ) {<br>  console.log(j);   // 0, 1, 2, 3 =&gt; j is blocked scope in for loop<br>};<br>};<br>print()</pre><pre>/******************************************************************/</pre><pre>const n = 2;<br>n = 4;<br>console.log(n)   // TypeError: Assignment to constant variable</pre><p><strong>Arrow Function</strong></p><p>With arrow functions, we can shorten the syntax of the function, we do not need a return statement. If we have only one parameter we can skip parenthesis. Just like with below example of add function. In one-line return statements it can be in-lined and {} can be omitted.</p><p>Additionally, ‘this’ is evaluated differently, its value is the same as the context of the function.</p><pre>//ES5<br>function add(params) {<br>  return params + 2<br>}<br>add(4);  // 6</pre><pre>//ES6<br>const add = params =&gt; params + 2<br>add(4);  // 8</pre><p><strong>Default Parameters</strong></p><p>With ES6 we can default parameters at the same time we create them. Whereas with ES5 we define and had to define them in the body of the function. In carInfo() function there is only one mandatory parameter: model. Other, year and color parameters are optional, if they are not provided when function is invoked; the default value will be assigned. In instance of uninitiated parameter undefined value will apply.</p><pre>//ES5<br>function carInfo (model, year, color) {<br>  year = year || 2020;<br>  color = color || &#39;Red&#39;;<br>   return &#39;I own &#39; + model + &#39;, &#39; + year + &#39; &#39; +  color + &#39;.&#39;;<br>}</pre><pre>carInfo(&#39;Toyota&#39;, 2009, &#39;white&#39;) // I own Toyota, 2009 White.carInfo(&#39;Toyota&#39;, 2009) // I own Toyota, 2009 Red.</pre><pre>//ES6<br>function carInfo (model, year = 2020, color = &#39;Red&#39;) {<br>  return &#39;I own &#39; + model + &#39;, &#39; + year + &#39; &#39; +  color + &#39;.&#39;;<br>}</pre><pre>carInfo(&#39;Toyota&#39;, 2009, &#39;white&#39;) // I own Toyota, 2009 White.<br>carInfo(&#39;Toyota&#39;, 2009) // I own Toyota, 2009 Red.</pre><p><strong>String Templating</strong></p><p>String templating, also known as string interpolation, is nothing other than a great way to concatenate string. Let’s reference example form above and notice how we will get exactly the same outcome in a much more efficient way. Using correct syntax ${first} inside of back-ticked</p><pre>//ES6</pre><pre>function carInfo (model, year = 2020, color = &#39;Red&#39;) {<br>  return `I own ${model} ${year} ${color}.`;<br>}</pre><p><strong>Spread operator ( … )</strong></p><p>The syntax is for the spread operator are <strong>three dots(…). </strong>With this operator, we can simply combine arrays or objects or use as spreading elements together; use as an array argument in the function. Also, we can simply copy or concatenate.</p><pre>let arr1 = [&#39;January&#39;, &#39;February&#39;, &#39;March&#39;];<br>let arr2 = [&#39;April&#39;, &#39;May&#39;, &#39;June&#39;];<br>let result = [...arr1, ...arr2];</pre><pre>console.log(result); // [&#39;January&#39;, &#39;February&#39;, &#39;march&#39;, &#39;April&#39;, &#39;may&#39;, &#39;June&#39;]</pre><p><strong>Promises</strong></p><p>Promise a container or placeholder-holder that will hold future value. This feature is used in JavaScript for asynchronous programming. Before ES6 callback functions were used for this purpose, but with that they were some limitations. A promise is an object; it can be in three different states: fulfilled, rejected or pending. Promises itself is a subject for a blog. For now, it is important to remember that promises are built over callback; they create much cleaner and sufficient code. Very known examplet is <em>setTimeout().</em></p><pre>var wait1000 = new Promise((resolve, reject)=&gt; {<br> setTimeout(resolve, 1000)<br> }).then(()=&gt; {<br> console.log(&#39;Let&#39;s do it!&#39;)<br> })</pre><p>In conclusion, there are more great features that come with ES6, for many programmers is a great way to improve their codes, for some might be more challenging to change their way of adjusting to new syntax. Nevertheless its a great sign of a progress and modern way of programming.</p><p>Thank you for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a82fc6547019" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power of Keyword “this” in Javascript.]]></title>
            <link>https://medium.com/@saohlsen/the-power-of-keyword-this-in-javascript-5a0b5499490c?source=rss-93ccbc7e4503------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a0b5499490c</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[this]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[method-invocation]]></category>
            <dc:creator><![CDATA[Sabina S Ohlsen]]></dc:creator>
            <pubDate>Sun, 28 Jun 2020 22:22:00 GMT</pubDate>
            <atom:updated>2020-06-30T18:34:28.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*fAkrRtx-ipZXXzcx1YBOFg.jpeg" /></figure><p>The word “this” in Javascript is a very short word which consists of just four letters. “This” has made my life more complicated from the moment I was introduced to it while attending Bootcamp. I am sure many can relate to the frustration, scratch their heads, and overall feel how or why “<em>this”</em> works?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*Nj0UU1mfRE4IYMa3dJnqWg.png" /></figure><p>The moment I initially thought I had grasped the concept and felt good about starting immersion, the scratching of the head returned. This was not a good feeling, considering it was not a new subject. So I decided to teach myself (again), and go back to basics to understand the great powers of “t<em>his.”</em></p><p>What does “this” mean in Javascript?</p><p>In general vocabulary, “this” is a determiner that is used to identify a person or thing that is nearby.</p><p>And in Javascript “this” refers to a context in which a function is called and the value may differ as it depends on how a function is being invoked.</p><p>What are the ways a function can be invoked?</p><p>Well, there are five ways we can invoke a function in javascript:</p><ul><li>Free function invocation</li><li>Method invocation</li><li>Constructor invocation</li><li>Indirect invocation: Bind, Apply, Call</li><li>Global reference invocation</li></ul><p>Although we only have one invocation operator (), there are five patterns to call a function, each one has its characteristics and behaves differently when evaluating the value of “this”. Let’s discuss each pattern separately.</p><h3>Free Method Invocation</h3><p>Function is invoked without any reference to any specific object, just like name indicated, its free. Can only exist when the variable is declared with “var” keyword. In this pattern “this” refers to the global object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/0*LQ2wwkRNWfyknJIo" /></figure><h3>Constructor Invocation</h3><p>In this invocation of the keyword “this” refers to an instance of an empty object. This happens when we create a constructor function. We can add as many key/value pairs as we need in the object that exists inside of the constructor function. In the example below, we can build our taco as it is an instance of the constructor function of Taco. In Javascript, to create a constructor function PascalCase is used. Additional importance in constructor function is the operator “<strong><em>new</em></strong>.” Operator has to be used before the function is invoked. If we skip this step, we would be referencing a global object. And function would not have the correct return, end value will be undefined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5Cc3qIwMcZ5Fcmqp" /></figure><h3>Method Invocation</h3><p>What is the method? In Javascript “method” is when your object’s value is a function. The first methods that we learn while diving into Javascript are: push(), pop(), shift(), unshift() and they are array’s methods, as they exist in global array object. Main characteristics:</p><ul><li>function that is invoked as a method of a specific object</li><li>“this” will refer to value of the specific object</li><li>function is a data type and is passed as a value of an object</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Nvkc46AVggha0RGt" /></figure><h3>Indirect Reference: Call(), Apply() and Bind()</h3><p>Until now we had function inside of an object. However, what if they are they not? This is when function methods like call(), apply() and bind() play a big role in connecting an object to a function. They communicate call, apply, or bind each other.</p><ul><li>when invoked the first argument is a specific reference object with a value that needs to be accessed</li><li>need to be a chain to the function</li><li>they have their differences:</li></ul><p>call() — arguments are passed as a list</p><p>apply() — arguments are passed as an array</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EDIzvfkzxWoxtodp" /></figure><ul><li>bind()</li></ul><p>Object is always the first argument and other arguments are passed as a list.</p><p>Bind will not invoke a function but create a new one that can be used when needed.</p><p>New functions must be invoked in order for some action to happen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zN24XEXRZ5uQuL25" /></figure><h3>Global Reference</h3><p>Refers to the global window object or global reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*9Ohzt5hC0eoH01I1" /></figure><h3>Conclusion</h3><p>Concluding the subject, there is a useful mantra to quickly recognize the correct application of “this” :</p><blockquote><em>What is to the left of the dot (.) at call the time.</em></blockquote><p>However it does not apply to the indirect method of invocation. It would be too easy if it would.</p><p>If we follow the rules we should be better off with the concept, and we will scratch our heads a little less.</p><p>Thank you for reading, stay tuned for more!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*F9zPkgidF1S00Q5cWbEdBA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a0b5499490c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>