<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vivian Ijomah </title>
    <description>The latest articles on DEV Community by Vivian Ijomah  (@vivaluv).</description>
    <link>https://dev.to/vivaluv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F854470%2Fba58d5a6-5ba4-4c78-b82b-0e613e16662d.jpg</url>
      <title>DEV Community: Vivian Ijomah </title>
      <link>https://dev.to/vivaluv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vivaluv"/>
    <language>en</language>
    <item>
      <title>Beginners guide to JavaScript Variables</title>
      <dc:creator>Vivian Ijomah </dc:creator>
      <pubDate>Thu, 01 Dec 2022 00:28:39 +0000</pubDate>
      <link>https://dev.to/vivaluv/beginners-guide-to-javascript-variables-3584</link>
      <guid>https://dev.to/vivaluv/beginners-guide-to-javascript-variables-3584</guid>
      <description>&lt;p&gt;Hello World, JavaScript is one of the most popular web technologies that when mastered will open a new door of creativity and power in building web applications.&lt;br&gt;
With the JavaScript language, we deal with a lot of data or information, this data or information needs to be stored somewhere we can quickly have access to.&lt;br&gt;
The box or container for storing data are &lt;code&gt;variables&lt;/code&gt;.&lt;br&gt;
In this post, we take a look at &lt;code&gt;variables&lt;/code&gt; in JavaScript, we will learn what variables are, how to create variables, how to store values and how to access the stored values.&lt;/p&gt;

&lt;p&gt;Let's get started&lt;/p&gt;

&lt;p&gt;What are variables?&lt;/p&gt;

&lt;p&gt;With most web applications, you may want to work with some information or data. For instance, if you plan to build the next social media application, you may want to keep information like who created an account, who posted, who liked a post etc.&lt;br&gt;
The way to keep track of these informations or data is store them in &lt;code&gt;variables&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Variables are boxes that stores values or information or data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The value or data stored can then be used during the program execution.&lt;br&gt;
Every variable has three main structures&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The name : to uniquely identify the variable&lt;/li&gt;
&lt;li&gt;The value : referring to the data or information stored in the variable&lt;/li&gt;
&lt;li&gt;The memory address : referring to the location in the computer's memory where the variable is stored.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's learn how to create variables.&lt;/p&gt;

&lt;p&gt;Declaring a variable&lt;br&gt;
To be able to store data in a variable, you need to declare it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You declare a variable with the &lt;code&gt;var&lt;/code&gt; (less recommended) or &lt;code&gt;let&lt;/code&gt; or &lt;code&gt;const&lt;/code&gt; keywords.&lt;/li&gt;
&lt;li&gt;Followed by the *name * you want to give to the variable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For instance&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;From the above, I have created a 'container' or box with a label **&lt;code&gt;firstName&lt;/code&gt;.&lt;br&gt;
After declaring the variable, you can now **store the data or value into the variable. The syntax will be&lt;br&gt;
&lt;code&gt;var variableName = value;&lt;/code&gt;&lt;br&gt;
Let's now assign the &lt;code&gt;firstName&lt;/code&gt; variable a &lt;code&gt;value&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName = "Vivian";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We have now stored the data or value "Vivian" in our &lt;code&gt;firstName&lt;/code&gt; &lt;code&gt;variable&lt;/code&gt; (or container).&lt;br&gt;
You can also declare multiple varialbes and assign values to each of them.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName = "Vivian";
let lastName = "Sylvanus";
let email = "vivaluv98@gmail.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The above declare three variables &lt;code&gt;firstName&lt;/code&gt;, &lt;code&gt;lastName&lt;/code&gt;, and &lt;code&gt;email&lt;/code&gt; and store three distinct piece of data or value in them.&lt;br&gt;
We can also declare multiple variables at a go, each variable declaration must be followed by a &lt;code&gt;,&lt;/code&gt; (comma).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//declaring 3 variables together
let firstName = "Vivian", lastName ="Sylvanus", email="vivaluv98@gmail.com";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Rules for variable name&lt;br&gt;
The following are some rules to take note of when declaring variables&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variable names cannot contain spaces&lt;/li&gt;
&lt;li&gt;The first letter of the variable can be [a-z, A-z], dollar sign ($), or underscore(_)&lt;/li&gt;
&lt;li&gt;Any digit can be used after the first letter&lt;/li&gt;
&lt;li&gt;Variable names are case sensitive. For instance &lt;code&gt;let firstName&lt;/code&gt; and &lt;code&gt;let FirstName&lt;/code&gt; are not the same&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Undefined vrs Undeclared Variables&lt;br&gt;
An &lt;code&gt;undefined&lt;/code&gt; variable is a variable that has been declared, but has not been assigned a value. Because it has not been assigned a value, the variable uses &lt;code&gt;undefined&lt;/code&gt; as its initial value.&lt;br&gt;
Let's declare a variable not assign it a value and see what the output will be&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName;
console.log(firstName)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The output will be &lt;code&gt;undefined&lt;/code&gt;&lt;br&gt;
However, an &lt;code&gt;undeclared&lt;/code&gt; variable is a variable that has not been declared. Accessing an undeclared variable will produce a &lt;code&gt;ReferenceError&lt;/code&gt;.&lt;br&gt;
For instance&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(message);
//ReferenceError: message has not been declared. 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Retrieving Values&lt;br&gt;
To easily grasp the concept of &lt;code&gt;variable&lt;/code&gt;, you can imagine it as box with a unique name or label on it, used for storing data. We can put any value or data in the box.&lt;br&gt;
To access the data or value in the box, you need to call the variable name (type the unique name you gave to the variable).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName = "Vivian"
//retrieving the value
firstName;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To dispay the output of a variable, you can use the &lt;code&gt;console.log()&lt;/code&gt; method and insert the variable name in the &lt;code&gt;()&lt;/code&gt; parenthesis.&lt;br&gt;
So, if you want to view what data is stored in the &lt;code&gt;firstName&lt;/code&gt; variable , you can write&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(firstName);
/*This will output the data stored in firstName in the developer console.*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can also change the value or data stored in the variable by assigning the variable a new data.&lt;br&gt;
See the code below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;firstName = "Chiamaka"; //change the value stored in the variable to Chiamaka 
console.log(firstName); //Chiamaka 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now when you call the &lt;code&gt;firstName&lt;/code&gt; variable, it will contain the value Chiamaka instead of Vivian&lt;br&gt;
Declaring a variable twice&lt;br&gt;
A variable should be declared only once, a repeated declaration of the same variable is an error&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName = "Vivian";
let firstName = "Chiamaka ";
/*SyntaxError: 'firstName' has already been declared */
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Types of variables&lt;br&gt;
All variables exist within a scope, which determines which part of the code can have access to the variables, and the life span of the variables.&lt;br&gt;
There are two types of variables supported in JavaScript&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local variables&lt;/li&gt;
&lt;li&gt;Global variables&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Local Variables&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A local variable is a variable that is declared inside a code block, a function body or inside a loop body.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In other words, if we declare a variable inside a curly braces &lt;code&gt;{}&lt;/code&gt; or block scope, it is a local variable. That variable can only be accessed inside that scope or &lt;code&gt;{}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Also, if you declare a variable inside a &lt;code&gt;function&lt;/code&gt;, JavaScript will add the variable to the function's scope, the variable will only exist inside the function&lt;/li&gt;
&lt;li&gt;It is recommended to use &lt;code&gt;let&lt;/code&gt; keyword when declaring local variables.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's examine the code below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function someFunc(){
    let firstName ="Vivian";
//accessing the local varialbe
    console.log(firstName)
}
someFunc() // output "Vivian"

//accessing the variable outside the scope {}
console.log('access out scope', firstName)
// Uncaught ReferenceError: firstName is not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Since firstName variable is declared inside the curly braces &lt;code&gt;{}&lt;/code&gt; or a function scope, it is a local variable and cannot be accessed outside &lt;code&gt;{}&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If you try to access &lt;code&gt;firstName&lt;/code&gt; outside of the function, as in the example above, you will get a &lt;code&gt;ReferenceError&lt;/code&gt; because the &lt;code&gt;firstName&lt;/code&gt; variable was not defined.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Global variable&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A variable declared anywhere within the script and not declared inside a block scope or function scope is a global variable&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In simple words, if the variable was not declared inside a function's body or in a block of code &lt;code&gt;{}&lt;/code&gt;, then it s a global variable. **&lt;br&gt;
Global variables can be accessed **anywhere in your code.&lt;br&gt;
It is recommended to use the &lt;code&gt;var&lt;/code&gt; keyword for global variables.&lt;br&gt;
Naming things right&lt;br&gt;
It is recommended that the name you give the variable, should have an obvious meaning, describing the data that it stores.&lt;br&gt;
A quick glance at variable names can reveal if the program was written by a novice or an experienced developer.&lt;br&gt;
Some good to follow rules are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use identifiable and human-readable names like &lt;code&gt;userName&lt;/code&gt; , &lt;code&gt;firstName&lt;/code&gt; or &lt;code&gt;tasks&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Avoid using abbreviations or short names like &lt;code&gt;a&lt;/code&gt;, , &lt;code&gt;usr&lt;/code&gt; etc.
Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In summary, you have learnt that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variables are like boxes for keeping data or information&lt;/li&gt;
&lt;li&gt;We can declare variables using &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; keywords.&lt;/li&gt;
&lt;li&gt;To access the value of the variable, call the variable name&lt;/li&gt;
&lt;li&gt;Lastly, variables should be named in a way that will help easily understand what is inside them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have found value, in this post, kindly leave a comment. Help other #codenewbies by sharing the post.&lt;br&gt;
Written with love from Lagos Nigeria,( thank you )&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>career</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>Arrow Function vs Function</title>
      <dc:creator>Vivian Ijomah </dc:creator>
      <pubDate>Tue, 29 Nov 2022 18:26:26 +0000</pubDate>
      <link>https://dev.to/vivaluv/arrow-function-vs-function-3h5j</link>
      <guid>https://dev.to/vivaluv/arrow-function-vs-function-3h5j</guid>
      <description>&lt;p&gt;In JavaScript, arrow functions provide a concise syntax for anonymous function expressions stripped off of their OOP baggage. They are a syntactic sugar on a subset of the function capabilities. Both can be used as closures capturing variables of the outer scope.&lt;br&gt;
Arrow functions are part of the ECMAScript 2015 standard also known as ES6. We will unpack variations of the arrow function ES6 syntax to their analogous function implementation and discuss the differences.&lt;br&gt;
The article assumes familiarity with the traditional functions and builds on the prior knowledge by drawing parallels between the two language mechanisms.&lt;/p&gt;

&lt;p&gt;Syntax&lt;/p&gt;

&lt;p&gt;The "fat arrow" syntax &lt;code&gt;=&amp;gt;&lt;/code&gt; is dedicated to arrow functions, hence the name.&lt;br&gt;
Arrow function declaration&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(arg1, arg2, ..., argN) =&amp;gt; expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(function (arg1, arg2, ..., argN) {
  return expression;
}).bind(this)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There's a lot going on here: omitted keywords, the implicit &lt;code&gt;return&lt;/code&gt; statement, &lt;code&gt;this&lt;/code&gt; context binding. Each aspect is discussed separately below.&lt;/p&gt;

&lt;p&gt;Semantics&lt;br&gt;
Return Expression&lt;/p&gt;

&lt;p&gt;Unlike ordinary functions (anonymous or otherwise), arrow functions implicitly return an evaluated expression without having to use the &lt;code&gt;return&lt;/code&gt; statement.&lt;br&gt;
Arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(arg1, arg2, ..., argN) =&amp;gt; expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function (arg1, arg2, ..., argN) {
  return expression;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There's a lot going on here: omitted keywords, the implicit &lt;code&gt;return&lt;/code&gt; statement, &lt;code&gt;this&lt;/code&gt; context binding. Each aspect is discussed separately below.&lt;/p&gt;

&lt;p&gt;Semantics&lt;br&gt;
Return Expression&lt;/p&gt;

&lt;p&gt;Unlike ordinary functions (anonymous or otherwise), arrow functions implicitly return an evaluated expression without having to use the &lt;code&gt;return&lt;/code&gt; statement.&lt;/p&gt;

&lt;p&gt;Arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(arg1, arg2, ..., argN) =&amp;gt; expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function (arg1, arg2, ..., argN) {
  return expression;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Once you get used to the syntax, you'll appreciate how much shorter the code becomes and would never want to go back.&lt;/p&gt;

&lt;p&gt;Block Statement&lt;/p&gt;

&lt;p&gt;The short return expression syntax cannot represent sequence of statements. That's where the familiar block statement &lt;code&gt;{}&lt;/code&gt; comes in. Within the curly braces you'd have to explicitly &lt;code&gt;return&lt;/code&gt; result of the function.&lt;br&gt;
Arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(arg1, arg2, ..., argN) =&amp;gt; {
  let result = doSomething();
  doDependentThing(result);
  return result;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function (arg1, arg2, ..., argN) {
  let result = doSomething();
  doDependentThing(result);
  return result;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The functions look more alike now, don't they?&lt;/p&gt;

&lt;p&gt;Object Expression&lt;/p&gt;

&lt;p&gt;Functions often return newly constructed objects. There's a catch: the object declaration notation &lt;code&gt;{}&lt;/code&gt; is indistinguishable from the block statement syntax. The solution is to surround the inline object with &lt;code&gt;()&lt;/code&gt; to make it an expression.&lt;br&gt;
Arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(arg1, arg2, ..., argN) =&amp;gt; ({
  prop1: value1,
  prop2: value2,
  ...,
  propN: valueN
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function (arg1, arg2, ..., argN) {
  return {
    prop1: value1,
    prop2: value2,
    ...,
    propN: valueN
  };
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Single Argument&lt;/p&gt;

&lt;p&gt;There's an extra syntactic sugar for a special case of an arrow function having only one argument. You can omit the parentheses &lt;code&gt;()&lt;/code&gt; around the argument.&lt;br&gt;
Arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arg =&amp;gt; expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function (arg) {
  return expression;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;No Arguments&lt;/p&gt;

&lt;p&gt;An arrow function w/o arguments is just an edge case of empty parentheses. Unlike the single argument syntax, the parentheses are required here.&lt;br&gt;
Arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;() =&amp;gt; expression
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent anonymous function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function () {
  return expression;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Context Binding&lt;/p&gt;

&lt;p&gt;Let's talk about the elephant in the room – the &lt;code&gt;this&lt;/code&gt; context. Arrow functions aside, this (pun intended) has always been a confusing topic in JavaScript.&lt;br&gt;
Functions have access to a special variable &lt;code&gt;this&lt;/code&gt; holding the context assigned in runtime. The problem is that the value varies depending on how the function is called which is error-prone and often undesirable.&lt;/p&gt;

&lt;p&gt;With callbacks being the primary use case, in most cases you'd want access to &lt;code&gt;this&lt;/code&gt; context defined at a declaration time, not at invocation. &lt;/p&gt;

&lt;p&gt;You'd find yourself sprinkling your code with the following closure boilerplate:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let self = this;
let callback = function () {
  self.doSomething();
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;or the re-binding to avoid &lt;code&gt;self&lt;/code&gt; in the callback:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let callback = function () {
  this.doSomething();
};
callback = callback.bind(this);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In contrast, arrow functions provide no &lt;code&gt;this&lt;/code&gt; context of their own and instead inherit the current "lexical" scope. They're naturally suited for inline callbacks.&lt;/p&gt;

&lt;p&gt;Equivalent arrow function:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let callback = () =&amp;gt; void this.doSomething();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The void operator discards the result returned by &lt;code&gt;this.doSomething()&lt;/code&gt;, if any. In practice, passing the result though is often okay and &lt;code&gt;void&lt;/code&gt; can be omitted. The block statement &lt;code&gt;{}&lt;/code&gt; is another (perhaps better) way to ignore the result.&lt;/p&gt;

&lt;p&gt;Class Methods&lt;/p&gt;

&lt;p&gt;Arrow functions come in handy in classes due to the nature of &lt;code&gt;this&lt;/code&gt; context. Ordinary methods are prone to losing class context when called from outside of class methods. Arrow methods are immune to this issue.&lt;br&gt;
The arrow method syntax is nothing but a class property declaration with an arrow function assigned in place of the value. Note the class properties are introduced in the ECMAScript 2017 specification.&lt;/p&gt;

&lt;p&gt;Arrow method (arrow function property):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Example {
  constructor(arg) {
    this.arg = arg;
  }

  callback = () =&amp;gt; {
    console.log(this.arg);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent ES6 class method:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Example {
  constructor(arg) {
    this.arg = arg;
    this.callback = this.callback.bind(this);
  }

  callback() {
    console.log(this.arg);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Examples&lt;br&gt;
Loop Refactoring&lt;/p&gt;

&lt;p&gt;Single argument is quite common in array method callbacks, such as &lt;code&gt;map()&lt;/code&gt; and its cousins, that iterate over items.&lt;br&gt;
Loop over array of items:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let ids = [];
for (let i = 0; i &amp;lt; items.length; i++) {
  ids.push(items[i].id);
}
return ids;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent traditional function implementation:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let ids = items.map(function (item) {
  return item.id;
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Equivalent arrow function implementation:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let ids = items.map(item =&amp;gt; item.id);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This example vividly demonstrates the level of code compression provided by arrow functions without sacrificing readability and even improving it.&lt;/p&gt;




&lt;p&gt;Enjoy the utility of arrow functions in your modern JavaScript code!&lt;/p&gt;

</description>
      <category>welcome</category>
      <category>developer</category>
      <category>learning</category>
      <category>community</category>
    </item>
    <item>
      <title>7 JavaScript Concepts You Should Be Familiar With As a Developer</title>
      <dc:creator>Vivian Ijomah </dc:creator>
      <pubDate>Tue, 29 Nov 2022 03:31:36 +0000</pubDate>
      <link>https://dev.to/vivaluv/7-javascript-concepts-you-should-be-familiar-with-as-a-developer-3oc0</link>
      <guid>https://dev.to/vivaluv/7-javascript-concepts-you-should-be-familiar-with-as-a-developer-3oc0</guid>
      <description>&lt;p&gt;As of 2022, JavaScript currently stands as the most commonly-used language in the world. It is used by 95 percent of all websites, whether small startups or giant corporations. Several of them are working on specific website or app that requires a strong understanding of this language.&lt;/p&gt;

&lt;p&gt;There are tons of frameworks and libraries available for javascript users. If you can understand Javascript fundamentals, you can learn these frameworks and libraries easily. Several concepts are confusing and overwhelming for several developers, but learning these Javascript concepts will benefit you in the long run. Not only that but learning these JavaScript concepts will help you build any kind of application and learn any framework and libraries.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Learning Javascript&lt;/em&gt; is going to come in handy to you in 2022. It will also help you in interviews as well. So without further ado, let's discuss some fundamental Javascript concepts that every JavaScript developer should know.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scope stands for variable access. So, the question is, what variable do I have access to when a code is running? However, in Javascript, you are always in the root scope by default (the window scope). These boundaries restrict variables and determine whether or not you have access to them. It restricts a variable's visibility or availability to other parts of the code. Understanding this concept will help you separate logic in your code and improve readability. We can define a scope in two ways:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local Scope&lt;/strong&gt;: It lets you access everything within the boundaries inside the box.&lt;br&gt;
&lt;strong&gt;Global Scope&lt;/strong&gt;: It lets you access everything outside the boundaries outside the box. It can't access a variable defined in the local scope unless you return it, as it is enclosed from the outside world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Async &amp;amp; Await&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Async &amp;amp; await are essentially syntactic sugar on top of Promises, and they give the means to keep asynchronous operations running more synchronously, just like Promises. As a result, you can handle asynchronous operations in javascript in several ways:&lt;/p&gt;

&lt;p&gt;ES5 -&amp;gt; Callback&lt;br&gt;
ES6 -&amp;gt; Promise&lt;br&gt;
ES7 -&amp;gt; Async &amp;amp; Await&lt;/p&gt;

&lt;p&gt;In cases where you wish to wait for the data to fully load before displaying it, you can perform a Rest API request using Async/Await. They are great syntactic improvements for NodeJS and browser programmers. It helps developers implement functional programming in Javascript and also makes the code more readable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Callbacks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a function is called, it must wait for another function to perform or return a value, creating the chain of functionalities. As a result, callbacks are generally used in javascript's asynchronous operation to provide synchronous functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closures&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Simply put, a closure is a function within another function with access to the outer function variables. The definition itself seems pretty straightforward, but the scope makes this definition unique. Inner functions (closure) can access variables defined in their scope (variables defined between curly brackets), their parent functions, and inside global variables. Now, here you need to keep in mind that the outer function cannot have access to the inner function variables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hoisting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Several developers get unexpected results because they are unfamiliar with the concept of hoisting in javascript. If you call a function before it is defined in javascript, you won't get an 'Uncaught ReferenceError' error. As a result, the javascript interpreter elevates variables and function declarations above the current scope (function scope or global scope) before executing the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IIFE (Immediately Invoked Function Expression)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As its name implies, IIFE is a Javascript function that immediately gets invoked and executed instantly as it is defined. A variable declared within IIFE cannot be accessed by the outside world, preventing the global scope from getting polluted. Thus, IIFE is primarily used for the instant execution of code and data privacy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Promises&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Promises are useful in asynchronous javascript operations when you need to start two or more back-to-back operations (or chain calls), where each subsequent function is called after the preceding one finishes. A promise is an object that will produce a single value shortly, either a solved value or a reason why it cannot be resolved (rejected). &lt;/p&gt;

&lt;p&gt;A promise can exist in one of three states:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fulfilled&lt;/strong&gt;: Operation completely successfully&lt;br&gt;
&lt;strong&gt;Rejected&lt;/strong&gt;: Failed operation&lt;br&gt;
&lt;strong&gt;Pending&lt;/strong&gt;: early state, neither fulfilled nor rejected.&lt;/p&gt;

&lt;p&gt;Thanks for taking your time to read this article. &lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>How to solve PHP parse/syntax errors</title>
      <dc:creator>Vivian Ijomah </dc:creator>
      <pubDate>Thu, 24 Nov 2022 16:16:43 +0000</pubDate>
      <link>https://dev.to/vivaluv/how-to-solve-php-parsesyntax-errors-4e2k</link>
      <guid>https://dev.to/vivaluv/how-to-solve-php-parsesyntax-errors-4e2k</guid>
      <description>&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;As a beginning PHP developer, you will encounter an error message from your PHP code, I remember when I kick-started as a PHP developer. When I write code to a certain extent, I'll get an error message, and it&lt;br&gt;
piece me off. So that is what we are going to bridge here, if you read and study carefully, you'll know several things about syntax error and parsing. So to skip much talk, If you are ready let's get started.&lt;/p&gt;

&lt;p&gt;Prerequisite&lt;/p&gt;

&lt;p&gt;The only thing you need for this course is your pen and jotter And pay proper attention.&lt;/p&gt;

&lt;p&gt;What is a parse error?&lt;/p&gt;

&lt;p&gt;Parse errors are caused by misuse or missing symbols in a particular line of code. The compiler catches the error and terminates the script.&lt;/p&gt;

&lt;p&gt;What is a syntax error?&lt;/p&gt;

&lt;p&gt;If the PHP code contains a syntax error, the PHP parser cannot interpret the code and stops working. For example, a syntax error can be a forgotten quotation mark, a missing semicolon at the end of a line, a missing parenthesis, or extra characters.&lt;br&gt;
In computer science, a syntax error is an error in the syntax of a sequence of characters or tokens that are intended to be written in a particular programming language. For compiled languages, syntax errors are detected at compile time. A program will not compile until all syntax errors are corrected.&lt;/p&gt;

&lt;p&gt;What is the difference between parse error &amp;amp; syntax error&lt;/p&gt;

&lt;p&gt;The difference between syntax errors is that parse error happens because of a syntax error. You (the developer) write code that contains a 'syntax error'. When that code is compiled, the compiler tries to parse your code but cannot which results in a parse error. If you are dealing with an interpreted language, (PHP, ASP, etc.)&lt;/p&gt;

&lt;p&gt;What causes parse &amp;amp; syntax error&lt;/p&gt;

&lt;p&gt;Parse errors are caused by: Unclosed brackets or quotes. Missing or extra semicolons or parentheses.&lt;br&gt;
A parse error: syntax error, unexpected appears when the PHP interpreter detects a missing element. Most of the time, it is caused by a missing curly bracket "}". To solve this, it will require you to scan the entire file to find the source of the error.&lt;/p&gt;

&lt;p&gt;How to solve parse and syntax error&lt;br&gt;
Solving syntax errors In steps.&lt;/p&gt;

&lt;p&gt;Look at the mentioned code line.&lt;br&gt;
More regularly you need to look at preceding lines as well.&lt;br&gt;
Look at the syntax colorization!&lt;br&gt;
White-space is your friend.&lt;br&gt;
You can freely add newlines between operators or constants and strings.&lt;br&gt;
Comment out the offending code.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;You have come to the end of this tutorial, so as a PHP developer, when an error is thrown on you screen, trace that error, from the line of code. And you'll find out that what causes it is either wrong input of semi-column, curly-brace, Etc..&lt;/p&gt;

&lt;p&gt;About the Author&lt;/p&gt;

&lt;p&gt;I am Vivian Ijomah i have grown full-blown skills in JavaScript, PHP, HTML &amp;amp; CSS, and more.&lt;br&gt;
I am currently freelancing, building websites for clients, and writing technical tutorials,teaching others how to do what i does. Any question drop on the comment box…&lt;br&gt;
Vivian Ijomah is open and available to hear from you. You can reach him on Linked In, Google, Facebook, GitHub, or on his website.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>php</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A Simple Crude Application Function With MYSQL and PHP.</title>
      <dc:creator>Vivian Ijomah </dc:creator>
      <pubDate>Wed, 23 Nov 2022 23:33:31 +0000</pubDate>
      <link>https://dev.to/vivaluv/a-simple-crude-application-function-with-mysql-and-php-4ef4</link>
      <guid>https://dev.to/vivaluv/a-simple-crude-application-function-with-mysql-and-php-4ef4</guid>
      <description>&lt;p&gt;Introduction&lt;br&gt;
CRUD Operations are typically performed on databases, hence, in this PHP CRUD Operations tutorial, you will implement CRUD techniques on MySQL databases with the help of PHP.&lt;/p&gt;

&lt;p&gt;CRUDE is an acronym for the four basic types of SQL commands: Create, Read, Update, Delete. Most applications have some kind of CRUD functionality, and we can assume that every programmer had to deal with CRUD at some point.&lt;/p&gt;

&lt;p&gt;A CRUD application uses forms to get data into and out of a database.&lt;br&gt;
We use CRUD apps every day. Most of the time, without notice. They keep us organized, they help digitize business processes, and they’re critical to application development.&lt;/p&gt;

&lt;p&gt;What is a crude application?&lt;br&gt;
CRUD apps are the user interface that we use to interact with databases. Broadly, CRUD apps consist of the database, the user interface, and the APIs.&lt;/p&gt;

&lt;p&gt;Modern web applications have a user perform at least one of the following operations on a database – creating a new record, reading or viewing existing records, updating, or deleting a record. If you have worked with a database, you have most likely worked with CRUD without realizing it.&lt;/p&gt;

&lt;p&gt;CRUD apps are used daily by several businesses and organizations to maintain their day-to-day workflow. HR uses CRUD apps to manage staff records and keep and track the keeping of employee leaves, and attendance.&lt;/p&gt;

&lt;p&gt;Customer success uses CRUD apps to solve customer tickets, and so on. Take a look at the blogging sites. You as a user can create your post, read your post, update your post and select your post. Bloggs are classic CRUD apps.&lt;/p&gt;

&lt;p&gt;How to Build a Crud Application.&lt;br&gt;
This is a step-by-step procedure on how to implement a simple user crud operation app with validation. Using this crud app, you can learn how to insert, read, update and delete data from a database in PHP.&lt;/p&gt;

&lt;p&gt;Follow the following steps to build a crud operation using PHP and MySQL;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step 1 – Create Database Table&lt;/li&gt;
&lt;li&gt;Step 2 – Create an index page(with a form)&lt;/li&gt;
&lt;li&gt;Step 3 – Create a config Page&lt;/li&gt;
&lt;li&gt;Step 4 – Create an action Page&lt;/li&gt;
&lt;li&gt;Step 5 – Create an update Page&lt;/li&gt;
&lt;li&gt;Step 6 – Create a Delete file.
Step 1: Create Database Table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, we need to create a database and database table where we save the ’ data or records.&lt;br&gt;
In the database, we will keep only four pieces of information in our table (people) – &lt;code&gt;name,&lt;/code&gt;Date of birth, ‘food, and ‘friend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database Name – yearbook&lt;/li&gt;
&lt;li&gt;Table Name – people&lt;/li&gt;
&lt;li&gt;CREATE TABLE users (&lt;/li&gt;
&lt;li&gt;uid INT PRIMARY KEY AUTO_INCREMENT,&lt;/li&gt;
&lt;li&gt;name VARCHAR(255) As defined,&lt;/li&gt;
&lt;li&gt;email VARCHAR(255) As defined,&lt;/li&gt;
&lt;li&gt;dob VARCHAR(255) As defined,&lt;/li&gt;
&lt;li&gt;food VARCHAR (255) As defined,&lt;/li&gt;
&lt;li&gt;friend VARCHAR (255) As defined,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;Step 2: Create Index File&lt;/p&gt;

&lt;p&gt;our index will contain our form, from which users can log in.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!doctype html&amp;gt;
  &amp;lt;html lang="en"&amp;gt;
    &amp;lt;head&amp;gt;
      &amp;lt;meta charset="utf-8"&amp;gt;
      &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;
      &amp;lt;link href="css/bootstrap.min.css" rel="stylesheet" &amp;gt;
      &amp;lt;link rel="stylesheet" href="css/owl.carousel.min.css"&amp;gt;
      &amp;lt;link rel="stylesheet" href="css/owl.theme.default.min.css"&amp;gt;
      &amp;lt;link rel="stylesheet" type="text/css" href="css/aos.css"&amp;gt;
      &amp;lt;link rel="stylesheet" type="text/css" href="css/fontawesome/css/all.min.css"&amp;gt;
      &amp;lt;link rel="stylesheet" href="css/style.css"&amp;gt;
      &amp;lt;title&amp;gt;Hello, world!&amp;lt;/title&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;
&amp;lt;section class="bg-dark py-5"&amp;gt;
   &amp;lt;div class="container"&amp;gt;
     &amp;lt;div class="row"&amp;gt;
      &amp;lt;div class="col-md-4 offset-md-4 bg-warning p-5"&amp;gt;
        &amp;lt;form action="action.php"    method="post"&amp;gt;

          &amp;lt;div class="input-group mb-3"&amp;gt;
            &amp;lt;span&amp;gt;
            &amp;lt;i class="fa fa-envelope"&amp;gt;&amp;lt;/i&amp;gt;
            &amp;lt;/span&amp;gt;
          &amp;lt;input type="text" name="name" class="form-control" placeholder="full name"&amp;gt;
        &amp;lt;/div&amp;gt;

      &amp;lt;div class="input-group mb-3"&amp;gt;
        &amp;lt;span&amp;gt;
        &amp;lt;i class="fa fa-calendar-alt"&amp;gt;&amp;lt;/i&amp;gt;
        &amp;lt;/span&amp;gt;
      &amp;lt;input type="text" name="name" class="form-control" placeholder="Date of Birth" 
     &amp;lt;/div&amp;gt;

    &amp;lt;div class= "input-group mb-3"&amp;gt;
     &amp;lt;span&amp;gt;
      &amp;lt;i class="fa fa-fish"&amp;gt;&amp;lt;/i&amp;gt;
      &amp;lt;/span&amp;gt;
&amp;lt;input type="text" name="name" class="form-control" placeholder="Forvourite food"
&amp;lt;/div&amp;gt; 

    &amp;lt;div class="input-group mb-3"&amp;gt;
     &amp;lt;span&amp;gt;
      &amp;lt;i class="fa fa-handshake"&amp;gt;&amp;lt;/i&amp;gt;
       &amp;lt;/span&amp;gt;
&amp;lt;input type="text" name="name" class="form-control" placeholder="best friend"
    &amp;lt;/div&amp;gt; 

&amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;

      &amp;lt;script src="js/bootstrap.bundle.min.js" &amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="Js/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="js/owl.carousel.min.js"&amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="js/aos.js"&amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="js/script.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;/body&amp;gt;
  &amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 3: Create Config File&lt;/p&gt;

&lt;p&gt;The config file is enables us connect to the database.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php 
$db= new mysqli ("localhost", "root", "", "yearbook");

/* server with default setting (user 'root' with no password) */
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');


/* Attempt to connect to MySQL database */
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD,);
 // check connection.
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 4: Create an Action File&lt;/p&gt;

&lt;p&gt;On your action page, you check for the submit button. we also collect all data from the form. we do the insert query as well. if you insert data, it will insert and redirect you back to the index page using the header location.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
include_once("config.php");

if(isset($_POST['submit'])){
$name=$_POST['name'];
$DOB=$_POST['DOB'];
$food=$_POST['food'];
$friend=$_POST['friend'];
$db-&amp;gt;query (INSERT INTO people(name,DOB,food,friend) VALUES ('$name', '$DOB', '$food','$friend');

header(location:index.php);
}
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;THE READ SECTION&lt;br&gt;
To read information from your database. you need to include your config.php in your index.php file. just before your Doctype using include_once(“config.php”). This must be done because one cannot read a database without the config.&lt;/p&gt;

&lt;p&gt;The next step is to write a select query. Because we want to select all from people(which is the table name) we will write the following code.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
include_once("config.php");
$list=db-&amp;gt;query("SELECT *FROM people order by DESC LIMIT 10")

?&amp;gt;



&amp;lt;!doctype html&amp;gt;
  &amp;lt;html lang="en"&amp;gt;
    &amp;lt;head&amp;gt;
      &amp;lt;meta charset="utf-8"&amp;gt;
      &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;
      &amp;lt;link href="css/bootstrap.min.css" rel="stylesheet" &amp;gt;
      &amp;lt;link rel="stylesheet" href="css/owl.carousel.min.css"&amp;gt;
      &amp;lt;link rel="stylesheet" href="css/owl.theme.default.min.css"&amp;gt;
      &amp;lt;link rel="stylesheet" type="text/css" href="css/aos.css"&amp;gt;
      &amp;lt;link rel="stylesheet" type="text/css" href="css/fontawesome/css/all.min.css"&amp;gt;
      &amp;lt;link rel="stylesheet" href="css/style.css"&amp;gt;
      &amp;lt;title&amp;gt;Hello, world!&amp;lt;/title&amp;gt;
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;
     &amp;lt;section class="bg-dark py-5"&amp;gt;

        &amp;lt;div class="container"&amp;gt;
          &amp;lt;div class="row"&amp;gt;
            &amp;lt;div class="col-md-4 offset-md-4  bg-warning p-5"&amp;gt;
              &amp;lt;form action="action.php" method="post"&amp;gt;


                 &amp;lt;div class="input-group mb-3"&amp;gt;
                  &amp;lt;span class="input-group-text"&amp;gt;
                    &amp;lt;i class="fa fa-envelope"&amp;gt;&amp;lt;/i&amp;gt;
                  &amp;lt;/span&amp;gt;
                  &amp;lt;input type="text" name="name" class="form-control" placeholder="full name"&amp;gt;
                &amp;lt;/div&amp;gt;


               &amp;lt;div class="input-group mb-3"&amp;gt;
                  &amp;lt;span class="input-group-text"&amp;gt;
                    &amp;lt;i class="fa fa-calendar-alt"&amp;gt;&amp;lt;/i&amp;gt;
                  &amp;lt;/span&amp;gt;
                  &amp;lt;input type="text" name="DOB" class="form-control" placeholder="Date of Birth"&amp;gt;
                &amp;lt;/div&amp;gt;



              &amp;lt;div class="input-group mb-3"&amp;gt;
                  &amp;lt;span class="input-group-text"&amp;gt;
                    &amp;lt;i class="fa fa-fish"&amp;gt;&amp;lt;/i&amp;gt;
                  &amp;lt;/span&amp;gt;
  &amp;lt;input type="text" name="food" class="form-control" placeholder="Favourite food"&amp;gt;
            &amp;lt;/div&amp;gt; 


                &amp;lt;div class="input-group mb-3"&amp;gt;
                  &amp;lt;span class="input-group-text"&amp;gt;
                    &amp;lt;i class="fa fa-handshake"&amp;gt;&amp;lt;/i&amp;gt;
                  &amp;lt;/span&amp;gt;
&amp;lt;input type="text" name="friend" class="form-control" placeholder="Best friend"&amp;gt;
                &amp;lt;/div&amp;gt;
&amp;lt;input type="submit" name="submit" value="login" class="btn btn-dark col-12"&amp;gt;
           &amp;lt;/form&amp;gt;
           &amp;lt;?php 
           while ($row=$list-&amp;gt;fetch_assoc()):?&amp;gt;

            &amp;lt;div class="my-3"&amp;gt;
            &amp;lt;h3 class="text-muted"&amp;gt;&amp;lt;i class="fa fa-user"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;?=$row['name'];?&amp;gt;&amp;lt;/h3&amp;gt;

            &amp;lt;p class="text-secondary"&amp;gt;
             &amp;lt;i class="fa fa-envelope text-dark"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;?=$row['dob'];?&amp;gt;
             &amp;lt;i class="fa fa-fish text-dark"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;?=$row['food'];?&amp;gt;
             &amp;lt;i class="fa fa-handshake text-dark"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;?=$row['friend'];?&amp;gt;

&amp;lt;a href="delect.php?uid=&amp;lt;?=$row['uid']?&amp;gt; class="text-danger" title="delete"&amp;gt;&amp;lt;i class="fa fa-trash"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;a href="update.php?uid=&amp;lt;?=$row['uid']?&amp;gt;" class="badge bg-success badge-pill"&amp;gt;update&amp;lt;i class="fa fa-edit"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/a&amp;gt;
      &amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;?php endwhile;?&amp;gt;

  &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
     &amp;lt;/div&amp;gt;
      &amp;lt;/section&amp;gt;



      &amp;lt;script src="js/bootstrap.bundle.min.js" &amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="Js/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="js/owl.carousel.min.js"&amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="js/aos.js"&amp;gt;&amp;lt;/script&amp;gt;
      &amp;lt;script src="js/script.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;/body&amp;gt;
  &amp;lt;/html&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The “list” above is called a resource. our objective is to convert the resources into an associative array using &amp;lt;?PHP while ($row =$list → fetch_assoc);&lt;br&gt;
$row is now the associative array.&lt;/p&gt;

&lt;p&gt;The above while loop brings everything to the database and displays it on the index page.&lt;/p&gt;

&lt;p&gt;Step 4: Create an Update File&lt;/p&gt;

&lt;p&gt;In our update file, we have a button called the update.php. but that button is a link to our index .php. if (isset($_GET)[‘uid’]; means the user is suspicious, then you kill the page. you must be aware of the previous information before you can do an update.&lt;br&gt;
To get the previous information you do a select query. that will enable you to specify the person you to want to update. with the value attribute, the update change will be effected and changes will be made in the database.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

  include_once("config.php");

if(isset($_GET['uid'])){

    $uid=$_GET['uid'];

    }else{


die(header('location:index.php'));

  }

  $list=$db-&amp;gt;query("SELECT * FROM people WHERE uid=$uid");

  $person=$list-&amp;gt;fetch_assoc()


//helps you read your database and put a limit to how much information that would 

display.

  ?&amp;gt;


&amp;lt;!doctype html&amp;gt;

    &amp;lt;html lang="en"&amp;gt;

      &amp;lt;head&amp;gt;

        &amp;lt;meta charset="utf-8"&amp;gt;

        &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;

        &amp;lt;link href="css/bootstrap.min.css" rel="stylesheet" &amp;gt;

        &amp;lt;link rel="stylesheet" href="css/owl.carousel.min.css"&amp;gt;

        &amp;lt;link rel="stylesheet" href="css/owl.theme.default.min.css"&amp;gt;

        &amp;lt;link rel="stylesheet" type="text/css" href="css/aos.css"&amp;gt;

        &amp;lt;link rel="stylesheet" type="text/css" href="css/fontawesome/css/all.min.css"&amp;gt;

        &amp;lt;link rel="stylesheet" href="css/style.css"&amp;gt;

        &amp;lt;title&amp;gt;Hello, world!&amp;lt;/title&amp;gt;

      &amp;lt;/head&amp;gt;

      &amp;lt;body&amp;gt;

       &amp;lt;section class="bg-dark py-5"&amp;gt;


      &amp;amp;lt;div class="container"&amp;amp;gt;
        &amp;amp;lt;div class="row"&amp;amp;gt;
          &amp;amp;lt;div class="col-md-4 offset-md-4  bg-warning p-5"&amp;amp;gt;
            &amp;amp;lt;form action="update_action.php" method="post"&amp;amp;gt;


              &amp;amp;lt;div class="input-group mb-3"&amp;amp;gt;
                &amp;amp;lt;span class="input-group-text"&amp;amp;gt;
                  &amp;amp;lt;i class="fa fa-envelope"&amp;amp;gt;&amp;amp;lt;/i&amp;amp;gt;
                &amp;amp;lt;/span&amp;amp;gt;



&amp;lt;input type="text" name="name" class="form-control" placeholder="full name" value="&amp;lt;?=$person['name']?&amp;gt;"&amp;gt;

                  &amp;lt;/div&amp;gt;


             &amp;amp;lt;div class="input-group mb-3"&amp;amp;gt;
                &amp;amp;lt;span class="input-group-text"&amp;amp;gt;
                  &amp;amp;lt;i class="fa fa-calendar-alt"&amp;amp;gt;&amp;amp;lt;/i&amp;amp;gt;
                &amp;amp;lt;/span&amp;amp;gt;



&amp;lt;input type="text" name="DOB" class="form-control" placeholder="Date of Birth" value="&amp;lt;?=$person ['dob']?&amp;gt;"&amp;gt;

                  &amp;lt;/div&amp;gt;


            &amp;amp;lt;div class="input-group mb-3"&amp;amp;gt;
                &amp;amp;lt;span class="input-group-text"&amp;amp;gt;
                  &amp;amp;lt;i class="fa fa-fish"&amp;amp;gt;&amp;amp;lt;/i&amp;amp;gt;
                &amp;amp;lt;/span&amp;amp;gt;



&amp;lt;input type="text" name="food" class="form-control" placeholder="Favourite food" value="&amp;lt;?=$person['food']?&amp;gt;"&amp;gt;

                  &amp;lt;/div&amp;gt; 


              &amp;amp;lt;div class="input-group mb-3"&amp;amp;gt;
                &amp;amp;lt;span class="input-group-text"&amp;amp;gt;
                  &amp;amp;lt;i class="fa fa-handshake"&amp;amp;gt;&amp;amp;lt;/i&amp;amp;gt;
                &amp;amp;lt;/span&amp;amp;gt;



&amp;lt;input type="text" name="friend" class="form-control" placeholder="Best friend" value="&amp;lt;?=$person['friend']?&amp;gt;"&amp;gt;

                  &amp;lt;/div&amp;gt;

&amp;lt;input type="hidden" name="uid" value="&amp;lt;?=$person['uid']?&amp;gt;"&amp;gt;

&amp;lt;input type="submit" name="submit" value="login" class="btn btn-dark col-12"&amp;gt;


&amp;lt;/form&amp;gt;


       &amp;amp;lt;/div&amp;amp;gt; 
    &amp;amp;lt;/div&amp;amp;gt;
  &amp;amp;lt;/div&amp;amp;gt;
&amp;amp;lt;/section&amp;amp;gt;



    &amp;amp;lt;script src="js/bootstrap.bundle.min.js" &amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;
    &amp;amp;lt;script src="Js/jquery.min.js"&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;
    &amp;amp;lt;script src="js/owl.carousel.min.js"&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;
    &amp;amp;lt;script src="js/aos.js"&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;
    &amp;amp;lt;script src="js/script.js"&amp;amp;gt;&amp;amp;lt;/script&amp;amp;gt;

  &amp;amp;lt;/body&amp;amp;gt;
&amp;amp;lt;/html&amp;amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 5: Create a Delete File&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

include_once("config.php");

if (isset($_GET['uid'])){

        $uid=$_GET['uid'];


    $db-&amp;amp;gt;query("DELETE FROM people WHERE uid='$uid'");


    header("location: index.php");



}


?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Finally, we have come to the completion of this tutorial and hopefully, you got value from it.&lt;/p&gt;

&lt;p&gt;Thanks for reading, please hit the like, clap, or heart button to show some love, I will see you in the next tutorial…&lt;/p&gt;

&lt;p&gt;We learned how to build a simple crude application with SQL and PHP.&lt;/p&gt;

&lt;p&gt;If you have any questions, please leave them in the comments. Like and share, and till next time, all the best!&lt;/p&gt;

&lt;p&gt;About the Author&lt;/p&gt;

&lt;p&gt;I am Vivian Ijomah, an enthusiastic developer with a passion for JavaScript, PHP, HTML &amp;amp; CSS.&lt;br&gt;
I work as a freelancer, building websites for clients, and love writing technical tutorials to teach others what I do. I am eager to hear from you. Reach me on LinkedIn, Github, or my website.&lt;/p&gt;

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