<?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 Rukayat Lukman on Medium]]></title>
        <description><![CDATA[Stories by Rukayat Lukman on Medium]]></description>
        <link>https://medium.com/@rktlukman?source=rss-e0c0356017e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*6dGWNoxLlgR7-6FDEyhlXQ.jpeg</url>
            <title>Stories by Rukayat Lukman on Medium</title>
            <link>https://medium.com/@rktlukman?source=rss-e0c0356017e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:50:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rktlukman/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[My 30days Challenge Experience On Vue.js]]></title>
            <link>https://medium.com/weekly-webtips/my-30days-challenge-experience-on-vue-js-be7d578c5257?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/be7d578c5257</guid>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Thu, 06 Aug 2020 13:24:26 GMT</pubDate>
            <atom:updated>2020-08-10T06:05:53.876Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*luWFDa7WWjANSbXxrMnxIA.png" /></figure><p>My 30days journey to learn Vue.js @ <a href="https://medium.com/u/7b680d00eba6">FemCode Africa</a> started on 7th of July, 2020, and ends on 7th of August 2020, although learning continues even after the end of the challenge. During the challenge, I was able to learn Vue.js basics (such as data binding, events, conditionals, looping etc), working with vue/cli, components, props, and so on.</p><p>I worked on 4 projects in total — one project per week. These are;</p><ul><li>The Punch Bag Game</li><li>Tip Calculator</li><li>Basic Calculator</li><li>Music app</li></ul><h3>The Punch Bag Game:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BwGaom1H-i-2cU0yS5yr-A.jpeg" /></figure><p>This was my first project on Vue.js after learning the basics. It was fun building a punch bag game.</p><p>When you punch the bag, it’s health decreases. When the health depreciates to 30%, an alert box will pop out to notify you and the color will change from white to red. When it’s 0%, the bag will be busted. You can always click the restart button to start again. It was a simple game but i had fun working on it.</p><p>Click to view ➡ <a href="https://tybabie-punchbag-game.netlify.app/">https://tybabie-punchbag-game.netlify.app/</a></p><p>A link to the repository ➡ <a href="https://github.com/Tybabie/Punch-bag-game">https://github.com/Tybabie/Punch-bag-game</a></p><h3>Tip Calculator:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*Nx4ixMqFBeyYfhwfGevhwA.jpeg" /></figure><p>Although I once built a tip calculator with jQuery ➡ ️<a href="https://tybabie-tip-calculator.netlify.app/">https://tybabie-tip-calculator.netlify.app/</a> but also decided to try it out with Vue.js ➡<a href="https://tybabie-vuejs-tip-calculator.netlify.app/">https://tybabie-vuejs-tip-calculator.netlify.app/</a></p><p>Users enter bill amount, the tip percentage to be given and the number of people sharing the bill. When users click calculate, the result will be displayed as shown in the picture below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*lOLLgQQmXRzMhTdQ61vu8A.jpeg" /></figure><p>Link to the jQuery repository ➡<a href="https://github.com/Tybabie/Tip-Calculator">https://github.com/Tybabie/Tip-Calculator</a></p><p>Link to the Vue.js repository ➡<a href="https://github.com/Tybabie/Vue.js-Tip-Calculator">https://github.com/Tybabie/Vue.js-Tip-Calculator</a></p><h3>Basic Calculator:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*zBNCE4l64Y9wO-Qz4ZTYTw.jpeg" /></figure><p>Building a calculator was the most challenging of the 4 projects i worked on. It was also on this project i started working with vue/cli and and learnt how to deploy a vue/cli site. For the first two projects, i worked with Vue CDN.</p><p>click to explore➡ <a href="https://tybabie-simple-calculator.netlify.app/">https://tybabie-simple-calculator.netlify.app/</a></p><p>A link to the repository ➡<a href="https://github.com/Tybabie/Simple-Calculator">https://github.com/Tybabie/Simple-Calculator</a></p><h3>Music app:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*UhaIMd3YxXEwyepByIkbPg.jpeg" /></figure><p>As a music lover, I chose the music-app as the last project for the 30days challenge. I created a list of few songs, there is a previous, play/pause, and next button in which each does what the name implies. And the background changes when the music is on. You can also select directly from the playlist.</p><p>Click to explore ➡ <a href="https://tybabie-music-app.netlify.app/">https://tybabie-music-app.netlify.app/</a></p><p>A link to the repository ➡<a href="https://github.com/Tybabie/Music-App">https://github.com/Tybabie/Music-App</a></p><p>After the 30days challenge, Learning and Projects continue… the next project I will like to work on is the Weather-app 😊🥰</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be7d578c5257" width="1" height="1" alt=""><hr><p><a href="https://medium.com/weekly-webtips/my-30days-challenge-experience-on-vue-js-be7d578c5257">My 30days Challenge Experience On Vue.js</a> was originally published in <a href="https://medium.com/weekly-webtips">Webtips</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Var, Let And Const Ways Of Creating Variables In JavaScript — What Makes One Different From…]]></title>
            <link>https://medium.com/weekly-webtips/the-var-let-and-const-ways-of-creating-variables-in-javascript-what-makes-one-different-from-6774a3a16b2b?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6774a3a16b2b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[variable-declaration]]></category>
            <category><![CDATA[const]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[var]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 17:06:44 GMT</pubDate>
            <atom:updated>2020-07-02T11:42:04.643Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Different Ways Of Creating Variables In JavaScript</strong></h3><h4>What makes one different from another?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*uCv2vTHge2awJ4ePLjXPlQ.jpeg" /></figure><p>You can declare a variable in JavaScript using three ways: using var, using let, using const. In this article, we will discuss the three ways of creating variables in JavaScript and their differences.</p><p>Firstly, we need to know what a variable is and how it can be created. Simply put, variables are containers for storing data values. Variables can be thought of as named containers, you can place data into these containers and then refer to the data simply by naming the container. Before you use a variable in a JavaScript program, you must declare(create) it. Variables are declared using reserved keyword var, let or const — Creating a variable in JavaScript is called “declaring” a variable. JavaScript variables can hold;</p><ul><li><strong>Numbers</strong>, e.g. 123, 120.50 etc.</li><li><strong>Strings</strong> of text e.g. “This text is a string” etc. <strong>Note that</strong> strings are either wrap in single (‘ ’) or double quotes (“ ”)</li><li><strong>Boolean</strong> e.g. true or false.</li><li><strong>Undefined</strong> — By default, when a variable is declared but not assigned, it is assigned the value of <strong>undefined.</strong></li><li><strong>Null </strong>represents an intentional absence of a value — it is usually set on purpose to indicate that a variable has been declared but not yet assigned any value.</li></ul><p>Before moving on, we need to know the general rules for constructing names for variables (unique identifiers)</p><ul><li>Names can contain letters, digits, underscores, and dollar signs.</li><li>Names must begin with a letter, they cannot start with a number.</li><li>Names can also begin with $ and _</li><li>Names are case sensitive (y and Y are different variables)</li><li>Reserved words (like JavaScript keywords e.g break, switch, let, var, const, if, else, return, this, throw, void, while, e.t.c) cannot be used as names</li><li>Names cannot have space inside of them(e.g first name). When naming an identifier with two words in it, it’s a best practice to use camel case. With this convention, the first letter of each word, excluding the first word, is uppercase. Example: firstName, myOtherVariableName</li></ul><h3>Declaration of variables</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*4MmnOokdwoss4IhcnVYRrQ.jpeg" /></figure><ol><li><strong>Declaration:</strong> The variable is registered using a given name within the corresponding scope (variable scope is explained in my article→<a href="https://bit.ly/JavaScript-Variable-Scope">https://bit.ly/JavaScript-Variable-Scope</a>).</li><li><strong>Initialization:</strong> When you declare a variable it is automatically initialized, which means memory is allocated for the variable by the JavaScript engine. Because of this, once a variable is declared, it takes a value of <strong>undefined</strong> even before assignment.</li><li><strong>Assignment:</strong> This is when a specific value is assigned to the variable. To <strong>assign</strong> a value to the variable, use the equal sign (assignment operator)</li></ol><p>Examples:</p><h4><strong>using var keyword</strong></h4><pre>var firstName;              <br>// Declaration and initialization</pre><pre>firstName = &quot;Rukayat&quot;;<br>// Assignment</pre><h4><strong>using let keyword</strong></h4><pre>let firstName;              <br>// Declaration and initialization</pre><pre>firstName = &quot;Rukayat&quot;;      <br>// Assignment</pre><h4><strong>using const keyword</strong></h4><pre><strong>It is important to note that when using const keyword, the variable must be assigned a value at the point of declaration, else, it will throw a syntax error.</strong> <strong>Therefore;</strong></pre><pre>const firstName;         <br>firstName = &quot;Rukayat&quot;;<br> // This syntax is <strong>wrong</strong> for const variables and will throw an error</pre><pre>const firstName = &quot;Rukayat&quot;; <br><strong>/</strong><strong>/This is the correct syntax</strong></pre><p>You can also assign a value to the variable when you declare it:</p><h4><strong>using var keyword</strong></h4><pre>var price     = 5;              // Number<br>var firstName = &quot;Rukayat&quot;;      // String<br>var developer = true | false;   // Boolean<br>var location  = null;           // Null<br>var blue;                       // undefined</pre><h4><strong>using let keyword</strong></h4><pre>let price     = 5;              // Number<br>let firstName = &quot;Rukayat&quot;;      // String<br>let developer = true | false;   // Boolean<br>let location  = null;           // Null<br>let blue;                       // undefined</pre><h4><strong>using const keyword</strong></h4><pre>const price     = 5;              // Number<br>const firstName = &quot;Rukayat&quot;;      // String<br>const developer = true | false;   // Boolean<br>const location  = null;           // Null<br>const blue;                       // undefined</pre><p>You can declare many variables in one statement. Start the statement with <strong>var</strong> or <strong>let</strong> or<strong> const</strong> and separate the variables by <strong>comma</strong>:</p><h4><strong>using var keyword</strong></h4><pre>var price = 5, firstName = &quot;Rukayat&quot;, developer = true;</pre><h4><strong>using let keyword</strong></h4><pre>let price = 5, firstName = &quot;Rukayat&quot;, developer = true;</pre><h4><strong>using const keyword</strong></h4><pre>const price = 5, firstName = &quot;Rukayat&quot;, developer = true;</pre><p>A declaration can span <strong>multiple</strong> <strong>lines</strong> instead of one long line(as implied in the examples above)</p><h4><strong>using var keyword</strong></h4><pre>var price = 5, <br>firstName = &quot;Rukayat&quot;, <br>developer = true;</pre><h4><strong>using let keyword</strong></h4><pre>let price = 5, <br>firstName = &quot;Rukayat&quot;, <br>developer = true;</pre><h4><strong>using const keyword</strong></h4><pre>let price = 5, <br>firstName = &quot;Rukayat&quot;, <br>developer = true;</pre><p>As we must have noticed, the examples above have the same syntax of declaring and assigning variables. That’s what is common about the three ways(var, let, const) of creating variables. Now let’s see what makes them different from one another.</p><h3>Difference between var, let and const in JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i8wNzXFIKKka1rLu09e99Q.jpeg" /></figure><ul><li>The first thing we can do with <strong>var</strong> that we <strong>cannot</strong> do with <strong>let</strong> or <strong>const</strong> is <strong>re-declaring</strong> a variable that has already been created. Example;</li></ul><pre>var firstName = &quot;Rukayat&quot;;<br>var firstName = &quot;Dasola&quot;;<br>console.log(firstName);  <br>//this code will print Dasola </pre><p>If the code above is created with <strong>let</strong> or <strong>const, </strong>it will throw a <strong>SyntaxError: Identifier ‘firstName’ has already been declared.</strong></p><pre>let firstName = &quot;Rukayat&quot;;<br>let firstName = &quot;Dasola&quot;;<br>console.log(firstName);  <br>//this code will throw a syntax error</pre><pre>const firstName = &quot;Rukayat&quot;;<br>const firstName = &quot;Dasola&quot;;<br>console.log(firstName);  <br>//this code will throw a syntax error</pre><p>With <strong>var</strong>, JavaScript accepts what you’ve done, even though it might not be what you wanted to do . Variables might accidentally got overridden resulting in change of values and might be difficult to track down when working with programs that deal with lots of different variables. But with <strong>let</strong> and <strong>const, </strong>JavaScript will let u know, so you can change the variable name to something else.</p><ul><li>Another difference is that <strong>var</strong> variables are function-based scope<strong> not</strong> block-based scope. That is many things like if statement which create code blocks <strong>don’t</strong> actually create a new scope when working with var. If we don’t create a new function, we don’t create a new scope. (You can read my article on variable scope to understand what variable scope is all about → <a href="https://bit.ly/JavaScript-Variable-Scope">https://bit.ly/JavaScript-Variable-Scope</a> )</li></ul><p>Example:</p><pre>if (10 === 10) {<br>var firstName = &quot;Rukayat&quot;;<br>}<br>console.log(firstName);  <br>//this code will print Rukayat</pre><p>Since we don’t create a function in the above example, everything is in the exact same scope. Meaning that we do have access to firstName anywhere even though it was defined in the if statement.</p><pre>function setName(){<br>var firstName = &quot;Rukayat&quot;;<br>}<br>setName();<br>console.log(firstName);  <br>//this code will throw a reference error</pre><p>In this example, the code will throw a <strong>ReferenceError: firstName is not defined. </strong>This is because var variables are function scoped, therefore, the variable cannot be accessed anywhere else except within the function</p><pre>function setName(){<br>var firstName = &quot;Rukayat&quot;;<br>console.log(firstName); <br>setName();<br> //this code will print Rukayat</pre><p>But <strong>let</strong> or <strong>const</strong>, are both block scoped. That is many things like if statement which create code blocks will create a new scope as do function. Example:</p><pre>if (10 === 10) {<br>let firstName = &quot;Rukayat&quot;;<br>}<br>console.log(firstName); <br>//this will code throw a reference error</pre><pre>function setName(){<br>let firstName = &quot;Rukayat&quot;;<br>}<br>setName();<br>console.log(firstName);  <br>//this code will throw a reference error</pre><p>The if statement create a new block as do function, therefore, we will not be able to access firstName anywhere else except where it’s defined. In the example, the code will throw a <strong>ReferenceError: firstName is not defined.</strong></p><pre>if (10 === 10) {<br>let firstName = &quot;Rukayat&quot;;<br>console.log(firstName);<br>}<br>//this code will print Rukayat</pre><pre>function setName(){<br>let firstName = &quot;Rukayat&quot;;<br>console.log(firstName);<br>}<br>setName();<br>//this code will print Rukayat</pre><ul><li>Accessing a variable before it’s declared is possible with <strong>var</strong>. When we create a variable with <strong>var</strong>, its declaration get twisted to the top of the scope. Example:</li></ul><pre>console.log(age);  <br>var age;<br>//this code will print undefined</pre><p>So in reality, the code above still looks like this:</p><pre>var age;<br>console.log(age);  <br>//this code will print undefined</pre><p>That is why the first code will print undefined even though age was accessed before the declaration. Let’s check another example out;</p><pre>console.log(age);<br>var age = 15;<br>//this code will print undefined</pre><p>The code above will still print undefined even though we have assigned a value of 15 to age. This is because, in reality, the code above looks like this:</p><pre>var age;<br>console.log(age);  <br>age = 15;<br>//this code will print undefined</pre><p>This proves that it’s only the declaration that gets twisted to the top of the scope and not the assignment. Another example is:</p><pre>age = 15;<br>console.log(age);<br>var age;<br>//this code will print 15</pre><p>This will print 15 because the age declaration is twisted to the top in reality like this:</p><pre>var age;<br>age = 15;<br>console.log(age);  </pre><p>But all these are impossible with <strong>let</strong> or <strong>const</strong>. If we try to access a let or const variable before it’s declared, we get a <strong>ReferenceError: Cannot access ‘age’ before initialization.</strong></p><ul><li>So far, we’ve seen how a <strong>var </strong>variable<strong> </strong>is different from a <strong>const</strong> and <strong>let </strong>variable. But how does a const variable differ from a let and var variable?</li></ul><p>As the name implies, const means constant, that is something that cannot change. Therefore a const variable <strong>cannot</strong> be reassigned. Example:</p><pre>const firstName = &quot;Rukayat&quot;;<br>firstName = &quot;Dasola&quot;;<br>console.log(firstName);  <br>//this will throw an error</pre><p>The code above will throw a <strong>TypeError: Assignment to constant variable</strong>. This is because once we create a variable with <strong>const, </strong>such a variable cannot be reassigned (changed).</p><p>But with <strong>var</strong> or <strong>let</strong>, reassignment of a variable is possible because they are not constant, that is their values can be changed using the appropriate syntax. Example:</p><pre>let firstName = &quot;Rukayat&quot;;<br>firstName = &quot;Dasola&quot;;<br>console.log(firstName);  <br>//this will print Dasola</pre><p><strong>It is important to note that</strong> although we cannot reassign a const variable, but we can reassign a const object properties. That is, if the constant variable is an object, we can still manipulate the object by giving its property/properties a new value. Example:</p><pre>const person = {<br>firstName: &quot;Rukayat&quot;,<br>lastName: &quot;Lukman&quot;,<br>age: 10<br>}<br>person.firstName = &quot;Dasola&quot;;<br>person.age = 15;<br>console.log(person);</pre><p>When we console.log(person), the result will print<strong> { firstName: ‘Dasola’, lastName: ‘Lukman’, age: 15 }</strong> because we were able to change firstName from Rukayat to Dasola and age from 10 to 15.</p><p><strong>Note that the properties values cannot be changed like this:</strong></p><pre>const person = {<br>firstName: &quot;Rukayat&quot;,<br>lastName: &quot;Lukman&quot;,<br>age: 10<br>}</pre><pre>person = {<br>firstName: &quot;Dasola&quot;,<br>lastName: &quot;Lukman&quot;,<br>age: 15<br>}<br>console.log(person); <br>//this will throw an error</pre><p>This code will throw a <strong>TypeError: Assignment to constant variable</strong>. Therefore, a <strong>const </strong>object properties cannot be changed using the second method <strong>but with the first method.</strong></p><p>From what we have discussed so far, we can conclude that <strong>var</strong> has its own flaws, making it a less an ideal way to create a variable in JavaScript. Therefore <strong>let</strong> should be preferred when declaring a variable that will be reassigned and <strong>const</strong> should be used for variables that we are sure will not be reassigned (constant variables)</p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6774a3a16b2b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/weekly-webtips/the-var-let-and-const-ways-of-creating-variables-in-javascript-what-makes-one-different-from-6774a3a16b2b">The Var, Let And Const Ways Of Creating Variables In JavaScript — What Makes One Different From…</a> was originally published in <a href="https://medium.com/weekly-webtips">Webtips</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference Between A Local Scope Variable And A Global Scope Variable In JavaScript]]></title>
            <link>https://medium.com/weekly-webtips/difference-between-a-local-scope-variable-and-a-global-scope-variable-in-javascript-39c3b60a87f3?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/39c3b60a87f3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[variables]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[scopes]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Wed, 01 Jul 2020 17:03:30 GMT</pubDate>
            <atom:updated>2020-07-02T11:47:33.001Z</atom:updated>
            <content:encoded><![CDATA[<h3>Differences Between Local Scope and Global Scope Variable In JavaScript</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gi83OrxsNQTgiEUV" /><figcaption>Photo by <a href="https://unsplash.com/@filisantillan?utm_source=medium&amp;utm_medium=referral">Filiberto Santillán</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The scope of a variable defines where it’s accessible in a program based off of where it was created. Just because we create a variable in one place in our program doesn’t mean it’s going to be accessible from anywhere in our script. In this article, we will discuss the two types of variable scope — local and global, and their differences. To know about what a variable is and how it can be created, you can read my article here → <a href="https://bit.ly/JavaScript-var-let-const">https://bit.ly/JavaScript-var-let-const</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*xOEvF63MASlMji9-CjZqbQ.jpeg" /></figure><p>There are two types of scope in JavaScript.These are:</p><ul><li>Global scope — Global scope contains all of the things defined outside of all code blocks. A <strong>code block</strong> simply consists of grouped statements inside curly braces (<strong>{ }</strong>). if statement, loops, function are examples of structure that create a code block. A global variable has global scope. A global variable is accessible from anywhere in the code.</li><li>Local Scope — Local scope contains things defined inside code blocks. A local variable has local scope. A local variable is only accessible where it’s declared.</li></ul><pre>let variableName = &quot;A string&quot;; //global scope</pre><pre>if (condition) {<br>block of code to be executed  //local scope <br>}</pre><pre>let anotherVariable = &quot;something else&quot;; //global scope</pre><p>In a scope, you can access variables defined in that scope, or in any parent/ancestor scope. Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*WNgX-1xN_OcIw_n6kNUUTg.jpeg" /></figure><p>For more visibility, let’s break the code down step by step, explaining each step, what each console.log() will print and why it’s so</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*ihLzEeIDy9j2zUj0BT_O_A.jpeg" /></figure><p>At index 1, we have our first variable which is a global variable. From what we’ve learned, we know that a global variable is accessible not just where it’s declared but everywhere else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*LjW7_BVb0sLY-91fU9PTHA.jpeg" /></figure><p>From index 3 - 12, we have if statement in which there is another if statement inside it, making the first if statement(at index 3)a <strong>parent</strong> to the second if statement(at index 7). Therefore, the local variable at index 4 is not only accessible in the if statement at index 3 but also accessible anywhere inside the if statement at index 7 because, in a scope, you can access variables defined in that scope, or in any parent/ancestor scope (in our case, the first if statement is the parent). We also have another local variable at index 8 which only belongs to the second if statement and is therefore only accessible inside it.</p><p>The console.log(varTwo) at index 5 will print <strong>two</strong> because varTwo is a local variable and we are accessing it at that same scope it’s declared. The console.log(varOne) at index 9 will print <strong>one</strong> because varOne is a global variable and we can access it outside its scope. The console.log(varTwo) at index 10 will print <strong>two</strong> because the if statement at index 3 is a parent to the if statement at index 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Gn9IFaD8qRQwXqBA3pZ6Gg.jpeg" /></figure><p>After the first two if statement, we have another variable declared at index 14. This is also a global variable because it is not declared inside any of the curly braces (code block) but outside. Therefore, it’s also accessible anywhere from its point of declaration.</p><p>After the global variable, we have another if statement in which a local variable is declared in it(index 17) and we have console.log(varThree) in it as well (<strong>remember that the varThree we are trying to access here is a local variable that belongs to the if statement at index 7</strong>). Therefore the console.log(varThree) at index 18 will throw a <strong>ReferenceError: varThree is not defined</strong> because it cannot be accessed except where it was defined.</p><p>The console.log(varFour) at index 21 will throw <strong>ReferenceError: varFour is not defined</strong> because varFour is a local variable and it is not accessible outside its scope. While the console.log(varOne) at index 22 and console.log(varFive) at index 23 print one and five respectively because both varOne and varFive are global variables.</p><p>When we have different scopes, we can define variables with the same name in each scope. Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*0QdXWmtY_HGjsMcB2DiE0w.jpeg" /></figure><p>In this example, we have three variables declared with the same variable name(firstName). We know this will throw an error if we defined them in the same scope. But since they are all declared in different scopes, it is allowed. This is known as <strong>variable shadowing</strong> in JavaScript. It’s is when a variable in a local scope uses its value instead of the value of a variable in parent scope. So each local variable is shadowing over the parent’s, basically hiding it from existence. That is why the console.log(firstName) at index 5, 9 and 13 will print <strong>Dasola, Tolani, Rukayat</strong> respectively without throwing an error. <strong>Note: </strong>the last console (index 13) prints Rukayat because the only variable it has access to is the global scope variable.</p><h4>Let’s check this out:</h4><pre>if (10 == 10) {<br>  firstName = &quot;Rukayat&quot;;<br>  console.log(firstName);<br>}</pre><pre>console.log(firstName);</pre><p>What did you from this code? The first console.log(firstName) should print Rukayat? And the second one outside the scope should throw an error?</p><p>Well, both will print Rukayat without throwing any error. Why? This is a “leaking” into the global scope. Assigning a value to a variable when the variable was never explicitly defined, causes it to be leaked into the global scope. So in the above example, when we assign a value (Rukayat) to firstName, we are actually creating a global variable, making it accessible everywhere. That is why it prints Rukayat in both cases.</p><p>So to avoid leaked global, a variable should be bound to a specific scope using the appropriate keyword(let, const, var). <strong>But note that var is a function-based scope and not block-based scope (read my article on the difference between var, let and const for more clarifications → </strong><a href="https://bit.ly/JavaScript-var-let-const">https://bit.ly/JavaScript-var-let-const</a><strong>)</strong></p><h3>How scope works with function in JavaScript</h3><p>The examples we’ve been using so far was the if statement, so we know how scope works with if statement in JavaScript. But what about function?</p><p>The only difference is that in function, the local scope doesn&#39;t only include everything created in the code block (inside curly braces) but also includes the function arguments. While the function name is a global scope</p><pre>function tempConverter (fahrenheit) {<br>  let celsius = (fahrenheit-32)*5/9;<br>  return celsius;<br>}</pre><pre>console.log (tempConverter(32));</pre><pre>console.log(fahrenheit); <br>console.log(celsius);</pre><p>So our global variable in this example is the function name (tempConverter) while the local variables are; the function argument (fahrenheit) and celsius. Therefore, console.log (tempConverter(32)) will print 0 on execution while console.log(fahrenheit) and console.log(celsius will throw a <strong>ReferenceError: fahrenheit is not defined </strong>and<strong> ReferenceError: celsius is not defined respectively. </strong>This is because tempConverter is a global variable (accessible outside its scope) while fahrenheit and celsius are local variables (only accessible in its scope)</p><p>This brings us to the end of this article. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39c3b60a87f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/weekly-webtips/difference-between-a-local-scope-variable-and-a-global-scope-variable-in-javascript-39c3b60a87f3">Difference Between A Local Scope Variable And A Global Scope Variable In JavaScript</a> was originally published in <a href="https://medium.com/weekly-webtips">Webtips</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML Elements And Their Functions]]></title>
            <link>https://medium.com/@rktlukman/html-elements-and-their-functions-c6a8d9509795?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6a8d9509795</guid>
            <category><![CDATA[html5]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Mon, 22 Jun 2020 15:04:33 GMT</pubDate>
            <atom:updated>2020-06-22T15:04:33.934Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*Ma9O39ayAZZJ8DDB5p2LTw.jpeg" /></figure><p><strong>HTML</strong> stands for Hypertext Markup Language. It is the standard markup language for documents designed to be displayed in a web browser. HTML is heavily used for creating pages that are displayed on the world wide web. Every page contains a set of HTML tags including hyperlinks which are used for connecting to other pages. Every page that we witness, on the world wide web, is written using a version of HTML code. The basic building blocks of any HTML pages are HTML elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*-xGuEbTNPCpR_KMejrzRGA.jpeg" /></figure><p>HTML is a tag-based language used for development of web pages. HTML tags are keywords (tag names) surrounded by angle brackets</p><p>&lt;tagname&gt;content&lt;/tagname&gt;</p><ul><li>HTML tags normally come<strong> in pairs </strong>like &lt;p&gt; and &lt;/p&gt;</li><li>The first tag in a pair is the <strong>start tag(</strong>often called the <strong>opening tag),</strong> the second tag is the <strong>end tag (</strong>often called the <strong>closing tag)</strong></li><li>The end tag is written like the start tag, but with a <strong>slash</strong> before the tag name</li></ul><h3><strong>Basic HTML Structure</strong></h3><pre>&lt;!DOCTYPE html&gt;</pre><pre>&lt;html lang=”en”&gt;</pre><pre>&lt;head&gt;</pre><pre>&lt;meta charset=”UTF-8&quot;&gt;</pre><pre>&lt;meta name=”viewport” content=”width=device-width, initial-scale=1.0&quot;&gt;</pre><pre>&lt;title&gt;Document&lt;/title&gt;</pre><pre>&lt;/head&gt;</pre><pre>&lt;body&gt;</pre><pre>&lt;h1&gt;My First Heading&lt;/h1&gt;</pre><pre>&lt;p&gt;My first paragraph.&lt;/p&gt;</pre><pre>&lt;/html&gt;</pre><p>OK…Let me do some explanations</p><p>The <strong>DOCTYPE</strong> declaration defines the document type to be HTML.</p><p>The text between <strong>&lt;html&gt;</strong> and <strong>&lt;/html&gt;</strong> describes an HTML document. The html lang attribute(&lt;html lang=”en”&gt;) is used to identify the language of text content on the web. This information helps search engines return language specific results, and it is also used by screen readers that switch language profiles to provide the correct accent and pronunciation. Typically this is a two letter code such as “en” for English, but it can also be an extended code such as “en-gb” for British English.</p><p>The text between <strong>&lt;head&gt;</strong> and <strong>&lt;/head&gt; element </strong>provides information about the document. The first &lt;meta&gt; tag holds the character set used. To display an HTML page correctly, a web browser must know the character set used in the page. The second &lt;meta&gt; tag holds the viewport element which gives the browser instructions on how to control the page’s dimensions and scaling. The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device). The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser. The text between <strong>&lt;title&gt;</strong> and <strong>&lt;/title&gt; element </strong>provides a title for the document. This will be displayed at the title bar.</p><p>The text between <strong>&lt;body&gt;</strong> and <strong>&lt;/body&gt;</strong> describes the visible page content. The &lt;<strong>body</strong>&gt;<strong> element</strong> contains all the contents of an html document, such as headings, paragraphs, images, hyperlinks, tables, lists, etc. <strong>Note</strong>: There can only be one &lt;<strong>body</strong>&gt; element in an html document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*WlJ92kEBgsRjJIEQjD39HA.jpeg" /></figure><h3><strong>Other Important HTML Elements</strong></h3><ul><li>A <strong>heading element</strong> implies all the font changes, paragraph breaks before and after, and any white space necessary to render the heading. The heading elements are &lt;h1&gt;, &lt;h2&gt;, &lt;h3&gt;, &lt;h4&gt;, &lt;h5&gt;, &lt;h6&gt; with &lt;h1&gt; being the highest (or most important) level and &lt;h6&gt;the least.</li><li>The &lt;<strong>p</strong>&gt; <strong>element</strong> represents a <strong>paragraph. </strong>A paragraph always starts on a new line, and is usually a block of text.</li><li>The &lt;<strong>hr</strong>&gt; <strong>element</strong> defines a thematic break in an html page (e.g. a shift of topic). The hr element is most often displayed as a horizontal rule that is used to separate content (or define a change) in an html page.</li><li>The &lt;<strong>br</strong>&gt; <strong>element</strong> is used to insert a line break or carriage-return within a parent element such as a paragraph &lt;p&gt; without breaking out of the parent container. The &lt;<strong>br</strong>&gt; <strong>tag</strong> is an empty<strong> </strong>tag which means that it has no end tag</li><li>The &lt;<strong>a</strong>&gt; <strong>element</strong> defines a hyperlink, which is used to link from one page to another. The most important attribute of the &lt;a&gt; element is the<strong> href </strong>attribute, which indicates the link’s destination.</li><li>The &lt;<strong>link</strong>&gt; <strong>element</strong> defines the relationship between the current document and an external resource. The &lt;link&gt; tag is most often used to link to external style sheets. The &lt;link&gt; element is an empty element, it contains attributes only.</li><li>The &lt;<strong>li</strong>&gt; <strong>element</strong> is used to represent an item in a list. It must be contained in a <strong>parent element</strong>: an ordered list ( <strong>&lt;ol&gt;</strong> ), an unordered list ( <strong>&lt;ul&gt;</strong> ). In unordered lists, list items are usually displayed using bullet points. In ordered lists, list items are displayed using numbers or alphabets.</li><li>The &lt;<strong>img</strong>&gt;<strong> element </strong>is used to embed an image in a web page. The &lt;<strong>img</strong>&gt; <strong>tag</strong> is empty, it contains attributes only, and does not have a <strong>closing</strong> <strong>tag</strong>.</li><li>The &lt;<strong>video</strong>&gt; <strong>element</strong> is used to embed video content in a document, such as a movie clip or other video streams.</li><li>The html &lt;<strong>form</strong>&gt; <strong>element</strong> is used for creating a form for user input. A <strong>form</strong> can contain textfields, checkboxes, radio-buttons and more. <strong>Forms</strong> are used to pass user-data to a specified URL.</li><li>The &lt;<strong>input</strong>&gt; <strong>element</strong> specifies an <strong>input</strong> field where the user can enter data. The input element<strong> </strong>is the most important <strong>form element</strong>. The input element can be displayed in several ways, depending on the type attribute.</li><li>The &lt;<strong>section</strong>&gt; element is a structural html element used to group together related elements.The &lt;section&gt; element defines sections in a document, such as chapters, headers, footers, or any other sections of the document</li><li>The &lt;<strong>div</strong>&gt; <strong>element</strong> is used as a container for html elements . Any sort of content can be put inside the &lt;<strong>div</strong>&gt; <strong>tag</strong>!</li><li>&lt;<strong>aside</strong>&gt; <strong>element</strong> represents a portion of a document whose content is only indirectly related to the document’s main content. Asides are frequently presented as sidebars or call-out boxes.</li><li>The &lt;<strong>span&gt; element</strong> is a generic inline container for inline elements and content. It used to group elements for styling purposes (by using the class or id attributes).</li><li>The &lt;<strong>nav</strong>&gt; <strong>element</strong> represents a section of a page whose purpose is to provide <strong>navigation</strong> links, either within the current document or to other documents. Common examples of navigation sections are menus, tables of contents, and indexes.</li><li>The &lt;<strong>header</strong>&gt; <strong>element</strong> represents introductory content, typically a group of introductory or navigational aids. It may contain some <strong>heading</strong> elements but also a logo, a search form, an author name, and other elements.</li><li>The &lt;<strong>footer</strong>&gt; <strong>element</strong> defines a footer for a document or section. A footer element typically contains: authorship information, copyright information, contact information, back to top links, related documents</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6a8d9509795" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple Expense Calculator Built With JavaScript]]></title>
            <link>https://medium.com/weekly-webtips/a-simple-expense-calculator-built-with-javascript-bcd824536a4c?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcd824536a4c</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[expenses]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Sun, 14 Jun 2020 19:11:16 GMT</pubDate>
            <atom:updated>2020-06-15T11:33:17.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TN3FfHTnDqEGF401zLMksw.jpeg" /></figure><p>It’s important to put things down on paper or in a digital planner to keep track of what you will spend money on. When you track<strong> </strong>your spending, you know where your money goes and you can ensure that your money is used wisely.</p><p>In this article, i will be talking about how the simple expense calculator above was built. Firstly, let’s look at its HTML and CSS source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*xRBeT6hO8B0dxl8HR7eOuA.jpeg" /></figure><p>Here’s the HTML. As indicated in number 18 and 22, the &lt;button&gt; tags have <strong>onclick </strong>event attributes in which each holds a function. Each function runs a specified line of code which will be discussed in the JavaScript section. This simply means that when the user clicks on the button, the function will be executed. Please take note of the id/class attribute given to each tag. Each id/class attribute is used to point to a style in the style sheet(CSS), and by JavaScript to manipulate the element with the specific id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KztM5L12IySQXLVZWOj-_w.jpeg" /><figcaption><strong>CSS</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*t6pGuR-IV5gmvtScrkXarw.jpeg" /><figcaption><strong>CSS contd</strong></figcaption></figure><p>The CSS shows how I styled the body and other HTML elements to give the desired result as indicated in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BDHZnGOlf9HOGyKMN2Iayw.jpeg" /><figcaption><strong>Output</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*TRX3ije4aYxySAP9ikdPsQ.jpeg" /><figcaption><strong>CSS contd (media query)</strong></figcaption></figure><p>And the last part of the CSS which is the media query implies that when the browser screen is smaller than 768px, the block of CSS properties as indicated should be executed. Thus, making the page responsive on smaller screens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*WRV03jI4mPU4rlPHqnDKPA.jpeg" /><figcaption><strong>Small screen view</strong></figcaption></figure><p>Now to the main deal of this article, let’s take a look at the JavaScript, how to make the expense calculator function as desired. Remember the id attributes assigned to the span, input, button, and div elements? It’s time to be used by JavaScript. Forgotten? You can always go back to the HTML</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcejY71AWNJmlF1PU2PBjg.jpeg" /><figcaption><strong>JavaScript</strong></figcaption></figure><p>Here, there are two main functions; addMoney(), addExpense() which have been specified in the onclick event attribute of the two &lt;button&gt; tags. These block of code will be executed when user click on the button. So let’s take a close look at each function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*UH4fw3hkjLoWu0kFm7pPEA.jpeg" /></figure><p><strong>addMoney() function</strong>. Here three variables were declared: totalBudget, currentBalance, money. The <strong>parseInt() </strong>function parses a string and returns an integer. So the parseInt was used to convert the string format to integer so that it can be used for computation. Note that for the variable money, <strong>.value </strong>was used instead of .innerHTML. This was used to get the value of the input field(i.e the value entered by the user). After the variables, I have the <strong>if else statement</strong>. Remember the syntax?</p><p>if (<em>condition</em>) {<br><em> block of code to be executed if the condition is true<br></em>} else {<br><em> block of code to be executed if the condition is false<br></em>}</p><p>The if-else statement in my code validates the input field. This implies that if the condition is true<strong>(</strong>i.e the input field is empty or isNaN(is Not a Number)<strong>)</strong>, then an alert box that says Please enter a valid number should pop up. And if the condition is false (i.e user enter the correct value), then the value(money) entered by the user should be added to the totalBudget and currentBalance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7l_eCw_UpoQTGZ6I4SZ66g.jpeg" /></figure><p>This picture indicates that on clicking the Add Money button while the input field was empty, the alert box popped up</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*JgkXXNzzm-EqcLO9BIJ2rA.jpeg" /></figure><p>And this indicates that when a correct value(500000) was entered, the value was added to the totalBudget and currentBalance.</p><p>Next is the second function addExpense()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*qCaDehEMy4OFAetcBvoj1w.jpeg" /></figure><p>Just as before, I declared my variables and made us of the parseInt() except for the expenseName because it’s not used in the calculation. After that, i have the <strong>else if statement.</strong> The syntax is;</p><p>if (<em>condition1</em>) {<br><em> block of code to be executed if condition1 is true<br></em>} else if (<em>condition2</em>) {<br><em> block of code to be executed if the condition1 is false and condition2 is true</em><br>} else {<br><em> block of code to be executed if the condition1 is false and condition2 is false<br></em>}</p><p>In the code above(the picture), i have the first condition to be;</p><p>if (expenseName.length == “ ”) {</p><p>alert(“Please enter an expense name”);</p><p>}</p><p>This implies that if the expense name input field is empty, then an alert box that says Please enter an expense name should pop out. And if the first condition is false, execute the next code (second condition) which says;</p><p>else if (expenseAmount == “ “ || isNaN(expenseAmount) ) {</p><p>alert(‘Please enter a valid expense amount’)</p><p>}</p><p>This implies that if the expense amount input field is empty or isNaN, then an alert box that says Please enter a valid expense amount should pop out. If this is also false, execute the next code (third condition) which says;</p><p>else if (expenseAmount &lt;= currentBalance){</p><p>currentBalance -= expenseAmount;</p><p>document.getElementById(‘currentBalance’).innerHTML = currentBalance</p><p>var para = document.createElement(‘p’)</p><p>para.innerHTML = `Expense Name : ${expenseName} &lt;br&gt; Expense Amount : ${expenseAmount}`;</p><p>document.getElementById(“addedExpenses”).appendChild(para);</p><p>}</p><p>This implies that if the expense amount is less than or equal to current balance, then the expense amount should be deducted from the current balance, and both the expense name and expense amount should be assigned to the element created(i.e the p element) which was appended to the div(with id “addedExpenses” ).</p><p>else{</p><p>alert(“sorry your expense amount is higher than your current balance”)</p><p>}</p><p>And finally, if the condition is false (i.e expense amount is greater than current balance), then an alert box that says Sorry your expense amount is greater than your current balance should pop up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jk1ZNZa-uYJHUjB3z6jBow.jpeg" /></figure><p>As the picture indicated, the current balance was 5000, and the expense amount was 6000, since 6000 &gt; 5000 then the alert box popped out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TN3FfHTnDqEGF401zLMksw.jpeg" /></figure><p>As indicated in the picture, since the expense amount was less than the current balance, both the expense name and expense amount was written in the paragraph created and appended to the div. This will continue to be so until the expense amount is greater than the current balance, then it will pop up the alert box.</p><p>That’s all for the simple expense calculator. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcd824536a4c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/weekly-webtips/a-simple-expense-calculator-built-with-javascript-bcd824536a4c">A Simple Expense Calculator Built With JavaScript</a> was originally published in <a href="https://medium.com/weekly-webtips">Webtips</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Form Validation Using JavaScript]]></title>
            <link>https://medium.com/@rktlukman/form-validation-using-javascript-8896817b427b?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8896817b427b</guid>
            <category><![CDATA[form-validation]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Sun, 07 Jun 2020 15:14:34 GMT</pubDate>
            <atom:updated>2020-06-07T19:16:53.357Z</atom:updated>
            <content:encoded><![CDATA[<p>JavaScript provides a way to validate form’s data on the client’s computer before sending it to the web server. It is important to validate the form submitted by the user because it can have inappropriate values, the data that is entered must be checked for correct form and value. Through JavaScript, we can validate name, password, email, phone numbers and more fields.</p><p>In this article, we are going to validate the name, phone number, email, password, and message box. Name that accepts not more than 15 words, phone numbers that accepts only numbers, email that accepts valid email, password that must have at least 1 capital letter, one special character and 1 number, message box that accepts not more than 350 words. A send button that pops out an alert box it was successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E5q5omHMfYS9Kyinonn-XQ.jpeg" /></figure><p>Here’s the form we are going to validate using JavaScript. But firstly, let’s have a view of the HTML and CSS source code.</p><blockquote><em>Want to read this story later? Save it in </em><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=blog&amp;utm_campaign=noteworthy&amp;utm_content=eid7"><em>Journal</em></a><em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*S9tjfwNtc8JSexqHMDL7zg.jpeg" /><figcaption><strong>HTML</strong></figcaption></figure><p>Take note of the &lt;form&gt; tag at number 11, it has an onsubmit attribute which return a formValidation() function. Here, we are validating the form on form submit. We’re going to be checking the form using a formValidation() function, which will be activated by the form’s submit event — therefore, using the onsubmit handler. On a simpler note, when user click on submit, it will check the form for correctness of values before sending it to the web server.</p><p>So i have my inputs for name, phone number, email, password, password confirmation, a text area for the message box, a div that holds the message to be displayed when user did not enter the correct values and lastly a send button. <strong>Of which each has its own id</strong>. Take note of the id given to each.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*RIaRWKA7FBFkFubgnA4z_Q.jpeg" /><figcaption><strong>CSS</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*QcX01NY-ROKgyu2a55mybw.jpeg" /><figcaption><strong>CSS contd</strong></figcaption></figure><p>The css shows how i styled the body, the section that holds the form, the inputs, the text area, the error message and the button.</p><p>Now to the main deal, let’s validate the form. Remember the formValidation () function? It’s time to give it instructions, and remember that the the form will validate onsubmit, that is, when you click the send button. And also time to make use of the id given to each field.</p><p>function formValidation(){</p><p>All instructions goes here;</p><p>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLovHvWBh-sRNAQd1xXqeA.jpeg" /></figure><p>Here is the entire js script for the validation. But i will like to break the code down step by step for explanation.</p><p><strong>Note:</strong> When writing the code, the last code (where i have<strong> return true</strong> just after the alert) should be set to <strong>return false </strong>until all the conditions have been stated. Otherwise, the form will be submitted. Example;</p><p>function formValidation(){</p><p>if (name.length == 0 || name.length &gt; 15) {</p><p>say = “Please enter name not greater than 15 words”;</p><p>error_message.innerHTML = say;</p><p>return false;</p><p>}</p><p><strong>return false;</strong></p><p>}</p><p>The return false in bold, will prevent the form from being submitted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*2FTc62KQS9wQeU5SgpW18w.jpeg" /></figure><p>Firstly, i declared my variables, and i want it to have the values of the input fields. That is, the values entered by the users. Therefore, i made use of the “document.getElementById()<strong>.value</strong>”. If you noticed, the error_message didn&#39;t have “.value”. This is because i want just the reference, not the value. Also, i declared a variable say, without assigning any value to it, this is because its value will change per each condition.</p><p>The next thing after declaring the variables is to make use of a conditional (if) statement. “<strong>if statement” </strong>is used<strong> </strong>to specify a block of code to be executed, if a specified condition is true. The syntax is;</p><p>if (<em>condition</em>) {<br><em> block of code to be executed if the condition is true<br></em>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*kDoYjB5vG_G9qAUdFuyHXg.jpeg" /></figure><p>This implies that if the condition in the bracket is true ( i.e length of the name entered by user is 0 (empty) or greater than 15), then the bock of code in the <em>curly bracket</em> should be executed (that is, error_message should write a text that says Please enter name not greater than 15 words). And the “<em>return false” </em>simply means that if the condition isn’t true(i.e false), then the block of code shouldn’t be executed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*ONGM-aIOS0Qj_Rj99wtsSg.jpeg" /></figure><p>The picture above shows that the name field was empty, therefore, it showed an error message ( Please enter name not greater than 15 words) when i clicked on send. Same will happen if the length is greater than 15.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*ijzimIqugX42i0xE-MO3MQ.jpeg" /></figure><p>Here, the picture shows that the name entered was less than 15 characters, therefore the condition was false, hence, the block of code wasn’t executed and therefore, checked the next condition(for phone number).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*9PfnPUKp_hFS6B2Ai_9qtg.jpeg" /></figure><p>Here’s the phone number conditional statement. The <strong>isNaN</strong>() method determines whether a value is NaN (Not-A-Number). The code implies that if the user enter a value that is not a number or the digits are less than 11, then the block of code should be executed (that is, error_message should write a text that says Please enter a valid phone number).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*73pU60hHQZGGer5nb7sk-g.jpeg" /></figure><p>The next condition is for the email. The <strong>indexOf</strong>() method searches a string/array for the specified item, and returns its position. It returns -1 if the item is not found. The code implies that if “@” is not found (i.e -1) or the length of the email is less than 11, then the error_message should write a text that says Please enter a valid email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LqnDotqfZ5VUG9eWdjQmNA.jpeg" /></figure><p>Next is the password. <strong>search</strong>() Method executes the <strong>search</strong> for a match between a regular expression and a given string object.The code implies that if the condition is true, i.e, password is empty, or it’s less than 10 characters, or capital letter A-Z isn’t found, or number from 0–9 isn’t found, or any of the special character isn’t found, then it should execute the block of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*JW9BdBB_GWXYXO_f-gshvA.jpeg" /></figure><p>Next is to confirm if password matches when user re-enter password or doesn’t match. As the code simply implies, if confirm is not strictly equal to password, then execute the block of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*Zswlkuz_vHiQWBmevpDC3w.jpeg" /></figure><p>Next is the message box. The code implies that if the length of the message is 0 i.e empty or the length is greater than 350, then execute the block of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*wxjZ7_P-zwcY0rPEg6b-lg.jpeg" /></figure><p>And finally the alert box that says Form sent successfully when user enter the correct details and click on send. Please remember that the <strong>return true</strong> will be set to <strong>return false</strong> until all the conditions have been stated. This prevents the form from being submitted. It’s after all the conditions have been stated we can write <strong>return true,</strong> then the form can successfully be submitted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*yVikiLTJXg2jbiKLjb40Fw.jpeg" /></figure><p>Yeah… that will be all.</p><p>Here is a link to my pen on form validation using JavaScript. You can check it out. Thanks. <a href="https://codepen.io/tybabie/pen/PoZoBPg"><strong>https://codepen.io/tybabie/pen/PoZoBPg</strong></a></p><p>📝 Save this story in <a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_read_later_text">Journal</a>.</p><p>👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. <a href="https://usejournal.com/newsletter/noteworthy-in-tech/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_text">Read the Noteworthy in Tech newsletter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8896817b427b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Career Path As A Front End Web Developer - My journey]]></title>
            <link>https://medium.com/@rktlukman/my-career-path-as-a-front-end-web-developer-my-journey-4b1bbab4e606?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b1bbab4e606</guid>
            <category><![CDATA[career-development]]></category>
            <category><![CDATA[front-end-web-developer]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[mychoice]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Mon, 01 Jun 2020 10:48:51 GMT</pubDate>
            <atom:updated>2020-06-01T19:21:23.642Z</atom:updated>
            <content:encoded><![CDATA[<p>The first slight interest i had in tech world was because of the money involved. I graduated as a chemist in 2018, as i was still on my NYSC program, i started looking out for job vacancies in 2019, that was when i noticed the huge gap between the salary scale of techies and non-techies. This made me curious about what techies do that makes them earn that much.</p><p>My curiosity became clear just few weeks after, when i saw a Decagon recruitment link on a whatsapp group and i applied for it. I read in details what the recruitment was about, registered and started going through some of the courses of freecodecamp as instructed by Decagon. That was when i realized coding isn&#39;t really a joking stuff and also realized it worth, especially when i started taking the JavaScript course. In fact, i barely understood the JavaScript topics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhR0GNM_wrfEawQ4HfU2ZQ.jpeg" /></figure><p>Long story short, i took the test, passed and i was invited for interview but couldn&#39;t make it to the Decagon bootcamp. I met a fellow applicant named Habeeb, he is a code lover and has passion for anything tech. We became friends and he enlightened me more about tech world. I gave up on coding cause i thought coding wasn&#39;t for me after all the JavaScript stress plus the fact that i had not understood the topics then. But Habeeb really wanted me to be a techie, so he kept sending me links for online courses, invited me for various programs involving digital skills acquisition. I started with an edx course — Data Analysis, it seemed interesting to me but the passion wasn&#39;t there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*jN8VX46oZORN9OZdQz9zGQ.jpeg" /></figure><p>Fast forward to when my friend, Habeeb sent me a link to register for fem-boot organized by Femcode Africa for ladies. I neglected the link because i wasn&#39;t interested. Few days passed, he asked if i had registered and persuaded me to register when he learnt i hadn&#39;t. So i registered and my journey as a Front end web developer began gradually. Although, at first i didn&#39;t take it with utmost seriousness and at a point, i wanted to quit when i couldn&#39;t meet up with an assignment deadline submission(a small project needed to be submitted before moving to another stage of learning). I wasn&#39;t that bothered about that because i haven&#39;t falling in love with coding. As usual of my friend checking up on me, it was on a Friday, he asked about the progress of the fem-boot training, i told him the truth that i was about to quit as i couldn&#39;t meet up because of the stress i was facing at my place of work itself. He advised me not to quit and try to give at least an hour or two out of my busy schedule for the training. Thank God i didn&#39;t neglect his advise. On getting home, i slide into my tutor’s DM, told him i was yet to submit the assignment and asked if i could still submit because it already passed submission deadline. I was happy when he said yes, so i devoted that weekend for the assignment. I submitted and was added to the new channel for the next stage of learning. Learning continued and i said to myself that i must see to the end of the training. No more giving up!!!</p><p>As time went on, a link was sent to the learning track to apply for Femcode Africa a Year Internship Program. No doubt i was 100% interested. Fortunately, front end web development which i was learning in the fem-boot was also part of the track of the internship program. So i applied to be a front end intern cause i know it will enhance my learning process and since both are programs organized by same company (Femcode Africa), it’s all good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*VkXrGSV6fp-6WPOKYUX0lQ.png" /></figure><p>After some challenges, i was accepted as an intern. A front end web developer intern @ Femcode Africa, wow i was so happy. The excitement i felt that day made me realized i have found <strong>my passion!</strong> I have found a <strong>new career path </strong>for myself! I have fallen in love with being a <strong>Front End Web Developer. </strong>It dawned on me that you only give up on what u do not have passion for. Ever since i found my passion in tech, I had<strong> never </strong>thought of giving up on it and <strong>never</strong> will.</p><p>My sincere appreciation goes to My friend, Habeeb, through whom i was able to find my passion. Also to a friend, Monsur, who keeps encouraging and supporting me. I will never forget to appreciate Femcode Africa for the opportunity given to me and other ladies out there. Without Femcode, i might still be my old self</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b1bbab4e606" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building A Coming Soon Page For Your Website’s Impending Launch]]></title>
            <link>https://medium.com/@rktlukman/building-a-coming-soon-page-for-your-websites-impending-launch-989eab7514db?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/989eab7514db</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[newbie-guide]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Sat, 23 May 2020 20:11:42 GMT</pubDate>
            <atom:updated>2020-05-30T15:50:51.786Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i9Ok5CyYxi8FZhFFGthGsg.jpeg" /></figure><p>You might be wondering why do i need a coming soon page? Coming soon page is actually necessary for websites about to be launched soon, or undergoing maintenance. You might think only large companies need a coming soon page, but the truth is that it can be used by anyone.</p><p>Basically, a Coming Soon page is a placeholder that announces that your actual website is “coming soon,” whether it be just launching or undergoing maintenance. Coming Soon pages usually have three goals in mind: to announce the actual website’s impending launch, offer some explanation of the site’s purpose, and to persuade visitors to return once the site is officially launched.</p><p>So one of the purpose of a Coming Soon page is to get your visitors attention and convince them to visit your site when it’s launched. For my coming soon page i will need basically three things; the company logo, social media icons (for the company social media handles) and the content.</p><p>To get started, create a folder(root folder) with a name of your choice, i used Femcode Africa for mine, since it’s a coming soon page for Femcode. Then proceed to open the folder in your text editor, then create an index file for the html (index.html). But before we start coding, we need to create some folders. This folder will serve as holders for our resources(images, icons, etc). So i will start by creating a folder named “resources” <strong>inside my root folder. </strong>Inside my resources, i will create another folder named images(to hold all my images), then a folder named css (to hold my css resources). <strong>Note</strong> that both the “images and css” folders are <strong>inside the “resources” folder</strong>. while the resources folder itself is <strong>inside the root folder</strong>(“Femcode Africa” in my case).</p><p>For our social media icons, we need an icon library, examples are font awesome icons, bootstrap icons, google icons. For this work, i will use font awesome library. Already have it on your system? Then just copy and paste it in your<strong> css</strong> folder that was created earlier. You that have that yet? You can go to<a href="https://fontawesome.com/download"> https://fontawesome.com/download</a> to download. Once downloaded, extract and copy the full folder and paste it in your<strong> css</strong> folder.</p><p>For our style sheet, i prefer to use external style sheet, if we are using external, then we need to create a <strong>file</strong> for it. i will name mine <strong>“style.css”</strong> .css is just the extension name which shows it’s a css file. And this <strong>file</strong> will also be<strong> inside our css folder. </strong>All things done well, we should have a structure as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*dUKsJ9SB7sQHePxwRQ-iUA.jpeg" /></figure><p>Please note that my index file is directly inside the root folder and <strong>NOT </strong>inside the sub-folders. Having this done, we can start coding by first creating our html structure. Give it a title and link the icon library and style sheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*jrmZHoadLqzXj86f_JEygw.jpeg" /></figure><p>The first &lt;meta&gt; tag holds the character set used. To display an HTML page correctly, a web browser must know the character set used in the page. The second &lt;meta&gt; tag holds the viewport element which gives the browser instructions on how to control the page&#39;s dimensions and scaling. The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device). The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.</p><p>The first &lt;link&gt; tag links the icon library needed. The second &lt;link&gt; tag links the external style sheet. The third one adds image to my title. I want the the title to display with the company’s logo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*NJro0F4yDUvCPBrZO4fH3A.jpeg" /><figcaption><strong>We can see that the image is displayed with the title</strong></figcaption></figure><p>Done with the head section! Now moving to the body. I will like to first write all my html, before styling with css. What do i need for my coming soon page?</p><ol><li>The company’s logo</li><li>The contents</li><li>Some social media icons that link to the company’s social media handles</li></ol><p>Let’s get started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BaI-yc6hYEP8FqHrtYo1-w.jpeg" /><figcaption><strong>Html file</strong></figcaption></figure><p>Firstly, i open a &lt;section&gt; tag and gave it an id of “landing”. Inside the section, i have my &lt;div&gt; holding all the contents, i gave it a class of “landing-content”, inside my div, i have another div that holds the image(the company’s logo), a &lt;h1&gt; tag, a &lt;p&gt; tag, and a div that holds the social media icons. All my contents are inside the “landing-content” div and the div is inside a section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*VnrV2g92UhevU2pECX5fwg.jpeg" /></figure><p>Here is our output. Not looking good right? Definitely we can’t leave it like this. We need to give it some styles. So let’s go to our external style sheet to do some wonders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*lE504jh2_UYdinPl6Od5Xg.jpeg" /></figure><p>The body style is just to clear any default padding or margin . For the section, used a linear gradient together with an image for the background. My previous article was about gradients and how it can be used. I set some other properties too; i didn’t want my image to repeat itself, i need it to cover the whole section, and i want the text to be white. Also gave a padding of 89px for all sides(top, right, bottom, left).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*0hUuMmhZacN48kV7-LvDuA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*CfbshcT80BCPFVQb8b9KOQ.jpeg" /></figure><p>The next style is for the landing-content div. I want it to have a shadow of color white(with opacity though), and i want it to have same background as the section, so i set the its background property to transparent, also gave it a padding top and bottom of 50px , and left and right of 20px, lastly i need my contents to be at the center.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C51EY6fm7O2srhJlLw_jmQ.jpeg" /></figure><p>We still need more styles, like reduce the image size and give the h1, p, and icons some styles too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*81tckFUuVitHRTuO8FfUdQ.jpeg" /></figure><p>Here are my styles for the image, h1, p and icon. Take note of the hover effect too, i want it to change color from white when we mouse over it, and the transition will make the change a bit slow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i9Ok5CyYxi8FZhFFGthGsg.jpeg" /></figure><p>Here is our final output. The last thing to do is to check the responsiveness on other device screen (mobile, tab etc). To check this, just right click on the page and inspect. Then click on the icon just before the element to change view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nUxErGuRjiGJyzWMD0LEOg.jpeg" /><figcaption>Checking the responsiveness on smaller screen</figcaption></figure><p>The image isn’t looking good right? It’s coming out of the div. Therefore we need to make it responsive on smaller screens via media queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*gHsLnAzZGIZD_-3nGOOqHg.jpeg" /></figure><p>The code here says, for screens with width 768px and smaller, the image width should be 200px(instead of 300px). This simply means that it’s only screens with width greater than 768px that will have the image width to be 300px.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*MsezSL13PAw9EKgWQLQGWA.jpeg" /><figcaption>Now looking good(mobile view)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i9Ok5CyYxi8FZhFFGthGsg.jpeg" /><figcaption>Desktop view</figcaption></figure><p>So we are done! You can as well decide to add some other stuffs like button, form, etc. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=989eab7514db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Combination Of Colors Using Gradients]]></title>
            <link>https://medium.com/@rktlukman/combination-of-colors-using-gradients-5a2e474b0ab?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a2e474b0ab</guid>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Mon, 11 May 2020 16:52:51 GMT</pubDate>
            <atom:updated>2020-05-11T16:52:51.934Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi guys, let’s talk about the use of gradients to combine two or more colors. CSS3 gradients let you display smooth transitions between two or more specified colors. There are two types of gradients</p><ul><li><strong>Linear Gradients (goes down/up/left/right/diagonally)</strong></li><li><strong>Radial Gradients (defined by their center)</strong></li></ul><p>Let’s do some practical examples 😊. So we will go to our text editor and create our html document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*qY5nYyQbp0rD8qbnhxUhjQ.jpeg" /><figcaption>Here’s mine</figcaption></figure><p>Let’s start with linear gradient.</p><p>To create a linear gradient you must define at least two color stops. Color stops are the colors you want to render smooth transitions among. the syntax for linear gradient is</p><p>background: linear-gradient(<em>direction</em>, <em>color-stop1</em>, <em>color-stop2, …</em>);</p><p>The direction is just the direction in which you want your gradient effect. It can be to bottom(default value), to left, to right etc, or you can use angle(deg). The color-stop are the colors you wants to combine. You must have at least to colors for gradient to be effective.</p><p>Let’s go back to our text editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*a4pMHiFbxaH_2op83V0RVg.jpeg" /></figure><p>In the above code, i have my &lt;div&gt; element with id “normal”. So i styled my div(generally) to have a margin of 30px, 40% width and height of 200px. <strong>Note</strong> that this will affect all our div elements. So i went ahead to use my id selector(#normal) to style my &lt;div&gt; element with id “normal”. <strong>Take note of the comments in my code.</strong> I used the syntax as accepted by the browsers indicated in the comments. The standard syntax should always come last.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*NkQYoTqxUHBxZBtRQ722Yg.jpeg" /><figcaption>Here is our output</figcaption></figure><p>From my code i said the direction should be “to top left” and i used two colors(blue and white). So you will notice that the top-left is very light(because of the white color combined with blue and the direction indicated in the code) and getting more deep to the right.</p><p>It’s also possible to use percentage with your colors, this will make it <strong>not</strong> to be distributed evenly. <strong>Color stops are automatically spaced evenly when no percents are specified.</strong></p><p>Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*t6RXxaGeWy0zk0uA3pdnHQ.jpeg" /><figcaption><strong>COLOR STOPS WITH PERCENTAGE</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*j9lavlnpFws_JYkxZ1utFg.jpeg" /><figcaption><strong>Output</strong></figcaption></figure><p>The basic difference between the first output and the second is the way it’s been spaced and this is due to the percent specified in the second code. The directions are both “to top left”</p><h3>Using Transparency</h3><p>CSS3 gradients also support transparency, which can be used to create fading effects. To add transparency, we use the rgba() function to define the color stops. The last parameter in the rgba() function can be a value from 0 to 1, and it defines the transparency of the color: 0 indicates full transparency, 1 indicates full color (no transparency).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*n5AaptMedywDfYsQ32xiRQ.jpeg" /><figcaption><strong>TRANSPARENCY</strong></figcaption></figure><p>I used rgba() for the first color. The first color is more transparent than the other color, the second is a full color(no transparency). The direction used here is an angle(deg)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*-m08EEaaypcpsjZHk-xHhA.jpeg" /></figure><p>The output shows a full color from the left and fades to the right.</p><h3>Repeating a linear-gradient</h3><p>The repeating-linear-gradient() function is used to repeat linear gradients</p><p>Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*PGEGMtYLeJ6cZTuga2B3rg.jpeg" /></figure><p>Our code here will result to a repeated linear-gradient. Direction is angle 190 degree, and i combined 3 colors. NOTE: The first color will not be given percent while the subsequent colors will be given desired percentages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*AtGFFOkzVqiWk52u71NnXg.jpeg" /></figure><h3>Radial Gradients</h3><p>Unlike linear-gradients that can be from top to bottom, left to right, vice-versa, and diagonally. A radial gradient is defined by its center. To create a radial gradient you must also define at least two color stops. The syntax for radial-radient is;</p><p>background: radial-gradient(<em>shape size </em>at<em> position, start-color, …, last-color</em>);</p><p>By default, shape is ellipse, size is farthest-corner, and position is center and the colors are evenly spaced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*ia-n3fKBoaPQU8GJw3y2fA.jpeg" /><figcaption><strong>Radial-gradient with default values</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*R0BYpXu0RM_Us4lUFdFQfg.jpeg" /><figcaption>OUTPUT</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*U5l_aB0PfKG8dkR8BPLO-A.jpeg" /><figcaption><strong>Radial-gradient with circle shape</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*UEFC8nlfTUhLJ2tlz7guCQ.jpeg" /><figcaption>OUTPUT</figcaption></figure><p>Notice the difference in the shapes. The fist(output) shape is ellipse which is default while the second is circle</p><h3>Repeating a radial-gradient</h3><p>The repeating-radial-gradient() function is used to repeat radial gradients</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*Xya0EvNGniHkYfyChTLP2A.jpeg" /><figcaption><strong>Example of repeating radial-gradient</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*JZ0DeOt4PxwkC230IZJhoQ.jpeg" /><figcaption>OUTPUT</figcaption></figure><p>This takes us to the end of linear and radial gradients.</p><p>Explore and enjoy! Thanks for reading 👍😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a2e474b0ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some Basics Of CSS]]></title>
            <link>https://medium.com/@rktlukman/some-basics-of-css-59d24ff95161?source=rss-e0c0356017e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/59d24ff95161</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Rukayat Lukman]]></dc:creator>
            <pubDate>Tue, 05 May 2020 20:06:23 GMT</pubDate>
            <atom:updated>2020-05-05T20:06:23.457Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s talk about how to style our html elements, to make our page look beautiful. HTML stands for <strong>H</strong>yper <strong>T</strong>ext <strong>M</strong>arkup <strong>L</strong>anguage. It’s used for describing web documents. A page will look boring without some styling. CSS( <strong>C</strong>ascading <strong>S</strong>tyle <strong>S</strong>heets) is used to style html elements. It tells how the contents of html elements are to be displayed on web pages.</p><p>OK, before we start with css, u sure must have html documents you wants to style. So to create one, just create a folder, then go to any text editor e.g Sublime text, atom, visual studio code etc to open your folder, from there, create a file, give it a name with an extension .html</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*T7Yuo6Nbemk33q4bIbkHDw.jpeg" /><figcaption><strong>Here’s Mine</strong>!</figcaption></figure><p>Next, we declare our document, give it a title and so on</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*bpUQqaVIAXYZGCf3unEWsw.jpeg" /></figure><p>The DOCTYPE declaration defines the document type to be HTML<br>The text between &lt;html&gt; and &lt;/html&gt; describes an HTML document<br>The text between &lt;head&gt; and &lt;/head&gt; provides information about the document<br>The text between &lt;title&gt; and &lt;/title&gt; provides a title for the document<br>The text between &lt;body&gt; and &lt;/body&gt; describes the visible page content<br>The text between &lt;h1&gt; and &lt;/h1&gt; describes a heading<br>The text between &lt;p&gt; and &lt;/p&gt; describes a paragraph</p><p>Now let’s check our output. To do this, simply go to your folder that was created earlier, by now you would see your file name (index in my own case). just click on it, and it will take you to your default browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*Wvs-TscrAPvbKpw0yvbvWw.jpeg" /><figcaption><strong>Here we are!</strong></figcaption></figure><p>like i said earlier, css can be used to style html to make it look beautiful. So let’s start with css.</p><h3>CSS Selectors</h3><p>A CSS rule-set consists of a selector and a declaration block. selector{property: value; property: value;}. Example h1{ color: red;}</p><p>CSS selectors are used to “find” (or select) HTML elements based on their element name, id, class, attribute, and more. <strong>The element selector </strong>selects elements based on the element name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*x96f2GWsS6fS-XfnwYb9IQ.jpeg" /><figcaption><strong>Example of an element selector</strong></figcaption></figure><p><strong>Note: </strong>The<strong> </strong>style is defined within the &lt;style&gt; element, inside the &lt;head&gt; section of an HTML page. Here, all the h1 elements will align to the center and have a color of red. To view the new output, just refresh the page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_utIPvqlDFxtoayAKNoew.jpeg" /><figcaption><strong>Output</strong></figcaption></figure><p><strong>The id selector</strong> is used to select one unique element. To select an element with a specific id, write a hash (#) character, followed by the id of the element.<strong> Note:</strong> To select an element with a specific id, the element to be styled must be given a specified id attribute (in the open tag of the element). Example: The style rule below will be applied to the html element with id=”head1&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*5omX1oFUe2ikJD0MeinEgA.jpeg" /><figcaption><strong>Example of an Id selector</strong></figcaption></figure><p>So i just made my head1 to have color of royal-blue and increased its size to 50 pixel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3_1JJsGphcAyAq-_GbWog.jpeg" /><figcaption><strong>Output</strong></figcaption></figure><h4>The class Selector</h4><p>The class selector selects elements with a specific class attribute. It can be used to style more than one element having the same class name. To select elements with a specific class, write a period (.) character, followed by the name of the class. <strong>Note:</strong> To select element(s) with a specific class, the element(s) to be styled must be given a class attribute (in the open tag of the element). Example: The style rule below will be applied to html element(s) with class=”head1&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*0mush4E4_xmrpMMCqAGiFw.jpeg" /></figure><p>All elements given a class attribute of “A” will be affected. (That is the h1 and p elements)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u3GOAx9juMHO9GCB-uSzCw.jpeg" /><figcaption><strong>output</strong></figcaption></figure><h3>Ways to Insert CSS</h3><p>There 3 methods of using css to style html elements</p><ul><li>Inline style</li><li>Internal style sheet</li><li>External style sheet</li></ul><h4>Inline Styles</h4><p>Inline styles are defined inside the opening tag of an element. To use inline styles, add the style attribute to the relevant element(in the open tag of the element). Example;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*hTpkQcjvYsAztmaHSSn2cQ.jpeg" /><figcaption><strong>This is a inline-style</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*p7HJKXExu5YnUNwyyimqxg.jpeg" /><figcaption><strong>Output</strong></figcaption></figure><h4>Internal Style Sheet</h4><p>Internal styles are defined within the &lt;style&gt; element, inside the &lt;head&gt; section of an html page. In the examples above, where we talked about selectors, internal style sheet was used.</p><h4>External Style Sheet</h4><p>An external style sheet is written in a text editor. The file should not contain any html tags. The style sheet file must be saved with a .css extension. The html page must include a reference to the external style sheet file inside the &lt;link&gt; element. The &lt;link&gt; element goes inside the &lt;head&gt; section. Example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*vluIZBCQLUYQUwxhWQnQzA.jpeg" /><figcaption><strong>An external style sheet</strong></figcaption></figure><p>Wondering what i did here? It’s simple! So i just created another file and i named it mystyle with an extension .css (indicating css file). Notice that mystyle.css doesn&#39;t have any html tag, just consists of selectors and declaration block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*flAdKy8V8BW1TW4Jansc2A.jpeg" /></figure><p>And here is the html file where we have all the html tags. <strong>Note that i included a reference to the external style sheet file inside the &lt;link&gt; element in the head section. </strong><em>Without referencing the style sheet when making use of external style sheet, the styles will not be effective.</em></p><p><strong>Note:</strong> An inline style (inside a specific html element) has the highest priority, which means that it will override a style defined inside the &lt;head&gt; tag, or in an external style sheet, or a browser default value.</p><h3>CSS Colors</h3><p>Colors are displayed combining RED, GREEN, and BLUE light. Colors in CSS are most often specified by:</p><ul><li>a valid color name — like “red”</li><li>an RGB value — like “rgb(255, 0, 0)”</li><li>a HEX value — like “#ff0000”</li></ul><h4>RGB (Red, Green, Blue)</h4><p>RGB color values can be specified using this formula: rgb(red, green, blue). Each parameter (red, green, blue) defines the intensity of the color between 0 and 255. For example, rgb(255, 0, 0) is displayed as red, because red is set to its highest value (255) and the others are set to 0.</p><h4>Hexadecimal Colors</h4><p>RGB values can also be specified using <strong>hexadecimal</strong> color values in the form: #<em>RRGGBB</em>, where RR (red), GG (green) and BB (blue) are hexadecimal values between 00 and FF (same as decimal 0–255). For example, #ff0000 is displayed as red, because red is set to its highest value (FF) and the others are set to the lowest value (00).</p><h3>CSS Borders</h3><p>The CSS border properties allow you to specify the style, width, and color of an element&#39;s border.</p><h4>Border Style</h4><p>The border-style property specifies what kind of border to display. The border-style property can have from one to four values (for the top border, right border, bottom border, and the left border). The following values are allowed:</p><p>dotted — Defines a dotted border<br>dashed — Defines a dashed border<br>solid — Defines a solid border<br>double — Defines a double border<br>groove — Defines a 3D grooved border. The effect depends on the border-color value<br>ridge — Defines a 3D ridged border. The effect depends on the border-color value<br>inset — Defines a 3D inset border. The effect depends on the border-color value<br>outset — Defines a 3D outset border. The effect depends on the border-color value<br>none — Defines no border<br>hidden — Defines a hidden border</p><h4>Border Width</h4><p>The border-width property specifies the width of the four borders(top, right, left, bottom). The width can be set as a specific size (in px, pt, cm, em, etc) or by using one of the three pre-defined values: thin, medium, or thick.</p><h4>Border Color</h4><p>The border-color property is used to set the color of the four borders(top, right,bottom, left). The color can be set by: name, rgb, hex</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*LXblw2wP9u-AQPoyHgUaRw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*nvgbRCb0Q4zAzPJ6_kYXYA.jpeg" /></figure><p>It is also possible to specify all the individual border properties in one property.</p><p>h1{<br> border: 5px solid red;<br> }</p><h3>CSS Margins and padding</h3><p><strong>The CSS margin</strong> properties are used to generate space around elements. The margin properties set the size of the white space OUTSIDE the border. While <strong>the CSS padding</strong> properties define the white space between the element content and the element border. The padding clears an area around the content (INSIDE the border) of an element.</p><p>Both margin and padding have four property values Which are. Auto, length, % and inherit. Both margin and padding can be specify for top, right, bottom, left.</p><p>Example</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*xVxK26JlfWLlV_GaOItD2A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*40AiZcn7WHOnwmIgk-Mo9w.jpeg" /></figure><p>Notice that there’s space between the fist heading and the heading with border, also there’s space at the left side. This is because of the margin top and left specified in the style.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*p5t-XRb-KpxRhHJ7t_yNGg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*coUmqeK3MJIoYdp6856fOA.jpeg" /></figure><p>Now notice the space between the element content and the porder, that’s the effect of padding.</p><h3>CSS Links</h3><p>With CSS, links can be styled in different ways depending on what state they are in. The four links states are:</p><p>a:link — a normal, unvisited link<br>a:visited — a link the user has visited<br>a:hover — a link when the user mouses over it<br>a:active — a link the moment it is clicked</p><p>When setting the style for several link states, there are some order rules:</p><ul><li>a:hover MUST come after a:link and a:visited</li><li>a:active MUST come after a:hover</li></ul><p>Links can be styled using css properties such as background-color, color, text-decoration, padding, margin, text-align, display, and so on.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W16oK0d46FL3efwtkbb6tw.jpeg" /></figure><p>The text between the opening html tag &lt;a&gt;and closing tag &lt;/a&gt; is the visible part while the href attribute specifies the destination address. The target =_blank opens the linked document in a new tab.</p><p>By default, a link will appear like this (in all browsers):</p><ul><li>An unvisited link is underlined and blue</li><li>A visited link is underlined and purple</li><li>An active link is underlined and red</li></ul><p>With css, i was able to remove the underline(using text-decoration: none;), changed the color and give it a background color</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*OPJ8m6KzfLjCh6vVv7BIgw.jpeg" /><figcaption><strong>Here’s my output</strong></figcaption></figure><p>According to my code above, when the link is unvisited and visited, it will be as indicated in the picture. But when you mouse over it and it’s active, the background color will change to navy blue. <strong>Note: the four link states can be styled separately</strong></p><p>These are just some basics of css, css is large in scope but trust me, it’s fun! Take your time and explore css, you gonna love it. You can learn more about css and html on <a href="http://www.w3schools.com/"><strong>www.w3schools.com</strong></a></p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59d24ff95161" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>