<?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: Peter Mwovi</title>
    <description>The latest articles on DEV Community by Peter Mwovi (@mwovi).</description>
    <link>https://dev.to/mwovi</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%2F813456%2Fc466e8ec-b8e9-45ed-a365-150861b2a060.png</url>
      <title>DEV Community: Peter Mwovi</title>
      <link>https://dev.to/mwovi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mwovi"/>
    <language>en</language>
    <item>
      <title>Introduction to Data Structures and Algorithms With Modern JavaScript.</title>
      <dc:creator>Peter Mwovi</dc:creator>
      <pubDate>Mon, 21 Feb 2022 09:33:11 +0000</pubDate>
      <link>https://dev.to/mwovi/introduction-to-data-structures-and-algorithms-with-modern-javascript-2ofb</link>
      <guid>https://dev.to/mwovi/introduction-to-data-structures-and-algorithms-with-modern-javascript-2ofb</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--22As45aO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/370lpvbfgr4g7ix2h5ta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--22As45aO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/370lpvbfgr4g7ix2h5ta.png" alt="Image description" width="880" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Data Structures are a specific method of arranging and storing data in computers so that we can execute more efficient operations on the data.&lt;/p&gt;

&lt;p&gt;Data structures are used in a wide range of fields, including Computer Science and Software Engineering. &lt;br&gt;
Data can be retrieved and stored in a variety of ways.&lt;br&gt;
Arrays and objects are two common JavaScript data structures that you are already familiar with.&lt;/p&gt;

&lt;p&gt;In JavaScript data structures, you'll get to learn how to access and change data using useful JS techniques like splice() and Object.keys(). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LHh_2ITu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v03h2jhrli44hoimn9vd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LHh_2ITu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v03h2jhrli44hoimn9vd.jpg" alt="Image description" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An algorithm is a set of instructions that describe how to perform something step by step. Breaking down an issue into smaller sections and carefully considering how to solve each portion using code will help you develop an effective algorithm.&lt;/p&gt;
&lt;h2&gt;
  
  
  Arrays
&lt;/h2&gt;

&lt;p&gt;An array in JavaScript is an ordered list of values. Each value is referred to as an element, and it is identified by an index.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q-6Guvnt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jhqmd703kxh4385yx0e3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q-6Guvnt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jhqmd703kxh4385yx0e3.gif" alt="Image description" width="335" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An array in JS has a couple of characteristics,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For starters, an array can include values of many sorts. You can have an array with items of the kinds number, string, and boolean, for example.&lt;/li&gt;
&lt;li&gt;Second, an array's size is dynamic and grows on its own. To put it another way, you don't have to declare the array size in advance. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Initializing a JavaScript Array&lt;/strong&gt;&lt;br&gt;
There are two ways to make an array with JavaScript. The first is to utilize the Array constructor in the following way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let results = new Array();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;results&lt;/code&gt; array is empty, and there are no elements in it. You can establish an array with an initial size if you know how many elements the array will hold, as seen in the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let results = Array(5);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The elements are passed as a comma-separated list to the Array() constructor to create an array and initialize it with certain elements.&lt;br&gt;
For example, the following builds the scores array that has five members (or numbers):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let scores = new Array(20,90,80,74,63);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, The array literal notation is the preferred method of creating an array. The square brackets [] are used to wrap a comma-separated list of elements in the array literal form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arrayName = [element1, element2, element3, ...];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let cars = ['honda', 'toyota', 'volvo'];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above example creates the cars array that holds string elements:&lt;/p&gt;

&lt;p&gt;You use square brackets without specifying any elements to construct an empty array, like in:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Basic Array operations&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1) Removing an element from an array's end&lt;/strong&gt; &lt;br&gt;
Use the &lt;code&gt;pop&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let teams = ['chelsea', 'arsenal', 'ManU', Liverpool', 'tottenham'];
const lastElement = teams.pop();
console.log(lastElement); 

**Output**
tottenham
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2) Removing an element from the array's beginning&lt;/strong&gt;&lt;br&gt;
 Use the &lt;code&gt;shift()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let teams = ['chelsea', 'arsenal', 'ManU', Liverpool', 'tottenham'];
const firstElement = teams.shift();
console.log(firstElement); 

**Output**
chelsea
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3) Adding a new element to an array's end&lt;/strong&gt;&lt;br&gt;
Use the &lt;code&gt;push()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let teams = ['chelsea', 'arsenal', 'ManU', Liverpool', tottenham'];
teams.push('Westham');
console.log(teams); 

**Output**
['chelsea', 'arsenal', 'ManU', Liverpool', 'tottenham','Westham']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4) Inserting an element at the start of an array&lt;/strong&gt; &lt;br&gt;
Use the &lt;code&gt;unshift()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let teams = ['arsenal', 'ManU', Liverpool', tottenham'];
teams.unshift('chelsea');
console.log(teams); 

**Output**
['chelsea', 'arsenal', 'ManU', Liverpool', 'tottenham','Westham']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5) Determine whether a value is an array.&lt;/strong&gt;&lt;br&gt;
Use &lt;code&gt;Array.isArray()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(Array.isArray(teams)); // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6) Locating an element's index in an array.&lt;/strong&gt;&lt;br&gt;
Use the &lt;code&gt;indexOf()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let teams = ['arsenal', 'ManU', Liverpool', tottenham'];
let index = teams.indexOf('Liverpool');

console.log(index); // 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Queue
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DlT3EpSk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6693ata6ko7lz7mm3pma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DlT3EpSk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6693ata6ko7lz7mm3pma.png" alt="Image description" width="390" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A queue is used by Javascript to keep track of the code that needs to be executed. Your printer also uses a queue to keep track of which documents are due to be printed next. To choose which patient should be admitted first, hospitals use a priority queuing system. &lt;br&gt;
To put it another way, there are queues everywhere. The queue is a crucial data structure to understand, from your local cafe to your computer's CPU and server or network.&lt;/p&gt;

&lt;p&gt;A queue works with the concept of &lt;code&gt;FIFO(First In First Out)&lt;/code&gt;.&lt;br&gt;
As a result, it conducts two basic operations: adding elements to the queue's end and removing elements from the queue's front. &lt;/p&gt;
&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4WkcvY8E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvlno2vfc4vbnq58jzvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4WkcvY8E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvlno2vfc4vbnq58jzvy.png" alt="Image description" width="880" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A data structure that holds a list of elements is known as a stack. A stack works on the &lt;code&gt;Last In, First Out (LIFO)&lt;/code&gt; principle, which means that the most recently added element is the first to be removed.&lt;br&gt;
Push and pop are the two main operations that occur only at the top of a stack. The push action adds an element to the top of the stack, whereas the pop operation removes one from the top.&lt;/p&gt;

&lt;p&gt;A stack can be used in a variety of ways. For instance, the most basic is to reverse a word. You do this by pushing a word into the stack, letter by letter, and then popping the letters out.&lt;br&gt;
The stack's other uses include text editors' "undo" features, syntax parsing, function calls, and expression conversion (infix to post-fix, infix to prefix, post-fix to infix, and prefix to infix).&lt;br&gt;
The push() and pop() functions of the JavaScript Array type allow you to use an array as a stack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let stack = [];

stack.push(1);
console.log(stack); // [1]

stack.push(2);
console.log(stack); // [1,2]

stack.push(3);
console.log(stack); // [1,2,3]

stack.push(4);
console.log(stack); // [1,2,3,4]

stack.push(5);
console.log(stack); // [1,2,3,4,5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Linked List
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0JHev3CP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkpf19nf7ncbkrpmsrfu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0JHev3CP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkpf19nf7ncbkrpmsrfu.png" alt="Image description" width="880" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A linked list, like an array, is a linear data structure. Unlike arrays, however, elements are not kept in a specific memory region or index. Rather, each element is its own object with a pointer or link to the next item in the list.&lt;/p&gt;

&lt;p&gt;Each element (often referred to as a node) has two components: data and a link to the next node. Any suitable data type can be used.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>algorithms</category>
      <category>programming</category>
    </item>
    <item>
      <title>JavaScript 101: Introduction to Modern JavaScript.</title>
      <dc:creator>Peter Mwovi</dc:creator>
      <pubDate>Fri, 11 Feb 2022 14:48:55 +0000</pubDate>
      <link>https://dev.to/mwovi/javascript-101-introduction-to-modern-javascript-8fh</link>
      <guid>https://dev.to/mwovi/javascript-101-introduction-to-modern-javascript-8fh</guid>
      <description>&lt;p&gt;So, you are new to JavaScript? So am I, Or at least I was a few months ago. &lt;/p&gt;

&lt;p&gt;Before we really get in depth with the complexities of the language and why it's basically the go to language for beginners, we will first begin with a history lesson and then learn it's basics.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmyoe3zzbjqc9tubkdkc.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmyoe3zzbjqc9tubkdkc.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;JavaScript, sometimes known as JS, is a programming language that, together with HTML and CSS, is one of the essential technologies of the World Wide Web.&lt;/p&gt;

&lt;p&gt;On the client side, over 97 percent of websites employ JavaScript for web page behavior, with third-party libraries frequently incorporated. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Brendan Eich&lt;/strong&gt; invented JavaScript in 1995. It was created for Netscape 2, and in 1997, it became the ECMA-262 standard. The Mozilla foundation continued to develop JavaScript for the Firefox browser after Netscape turned it over to ECMA. The most recent version of Mozilla was 1.8.5. (Identical to ES5).&lt;/p&gt;

&lt;p&gt;JavaScript was presented to the ECMA international standards organization by Netscape and Brendan Eich in 1996, and a technical committee (TC39) was formed to further develop the language.&lt;/p&gt;

&lt;p&gt;The first edition of ECMA-262 was published in June 1997.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3xgfltirnlci93supqv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3xgfltirnlci93supqv.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;It's all boring, I know but history is super important.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Continuing on, when the TC39 group met in Oslo in 2008 to discuss ECMAScript 4, they were split into two camps: those who supported ECMAScript 4 and those who opposed it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The ECMAScript 3.1 Camp&lt;/strong&gt;: &lt;br&gt;
Microsoft and Yahoo intended to upgrade from ES3 incrementally.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adobe, Mozilla, Opera, and Google formed the &lt;strong&gt;ECMAScript 4 Camp&lt;/strong&gt; to push for a major ES4 upgrade.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;August 13 2008, &lt;strong&gt;Brendan Eich&lt;/strong&gt; wrote an email:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's no secret that the JavaScript standards body, Ecma's Technical Committee 39, has been split for over a year, with some members favoring ES4, a major fourth edition to ECMA-262, and others advocating ES3.1 based on the existing ECMA-262 Edition 3 (ES3) specification. Now, I'm happy to report, the split is over&lt;br&gt;
.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The solution was to work together:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ECMAScript 4 was renamed to ES5.&lt;/li&gt;
&lt;li&gt;ES5 should be an incremental upgrade of ECMAScript 3.&lt;/li&gt;
&lt;li&gt;Features of ECMAScript 4 should be picked up in later  versions.&lt;/li&gt;
&lt;li&gt;TC39 should develop a new major release, bigger in scope  than ES5.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The code name for the upcoming new release (ES6) was "Harmony" (because to the division it caused?).&lt;/p&gt;

&lt;p&gt;The ES5 project was a big success.&lt;br&gt;
It was first published in 2009, and by July 2013, all major browsers (including Internet Explorer) were completely compliant.&lt;/p&gt;

&lt;p&gt;ES6 was also a huge success. It was released in 2015, and all major browsers were fully compliant by March 2017:&lt;/p&gt;

&lt;p&gt;The latest ES Version is the ES 12 which was released in June 2021.&lt;/p&gt;

&lt;p&gt;Enough with the history lesson now let's see the syntax. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzinnrylnl2dx968n3ox.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzinnrylnl2dx968n3ox.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;console.log()&lt;/strong&gt;&lt;br&gt;
To log or print messages to the console, use the console.log() method. &lt;br&gt;
It can also print objects and other information.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Declaring Variables&lt;/strong&gt;&lt;br&gt;
Any of these three keywords, along with a variable name, can be used to declare a variable in JavaScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In JavaScript versions prior to ES6, the &lt;strong&gt;var&lt;/strong&gt; is used.&lt;/li&gt;
&lt;li&gt;When a variable can be transferred, &lt;strong&gt;let&lt;/strong&gt; is the preferable method of declaring it.&lt;/li&gt;
&lt;li&gt;When declaring a variable with a constant value, &lt;strong&gt;const&lt;/strong&gt; is the preferred method.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var age;
let height;
const price = 300;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Undefined&lt;/strong&gt;&lt;br&gt;
undefined is a JavaScript value that denotes the absence of a defined value. The value of variables that are declared but not initialized will be undefined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var age;
 console.log(age); 
// Prints: undefined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;let Keyword&lt;/strong&gt;&lt;br&gt;
In JavaScript, &lt;em&gt;let&lt;/em&gt; creates a local variable that can be renamed. Initialization of a &lt;em&gt;let&lt;/em&gt; variable during its declaration is optional. If no value is assigned to a &lt;em&gt;let&lt;/em&gt; variable, it will be undefined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age; 
console.log(age); // Prints: undefined
count = 21;
console.log(age); // Prints: 21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;const Keyword&lt;/strong&gt;&lt;br&gt;
The term const can be used to declare a constant variable. It must be given a task. Any attempt to re-assign a const variable will result in a runtime error in JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const numberOfColumns = 4;
numberOfColumns = 8;
// TypeError: Assignment to constant variable.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Methods&lt;/strong&gt;&lt;br&gt;
Methods return information about an object and are called by putting an instance, a period, the method name, and parentheses to the end of the method name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`Math.random();
// Returns a number between 0 and 1`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;String .length&lt;/strong&gt;&lt;br&gt;
A string's .length property returns the total number of characters in the string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let message = 'Hello lux academy';
console.log(message.length);
// Prints: 17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Numbers&lt;/strong&gt;&lt;br&gt;
Numbers are the most basic data type.&lt;br&gt;
They encompass all integers as well as floating point numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let number = 2000; 
 let cash = 500;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Libraries&lt;/strong&gt;&lt;br&gt;
Methods can be accessed by inserting the library name, a period, the method name, and a set of parentheses to the library name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Math.random();
// Math is the library
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Boolean&lt;/strong&gt;&lt;br&gt;
A primitive data type is a boolean.&lt;br&gt;
It is possible for them to be true or false.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Single Line Comments&lt;/strong&gt;&lt;br&gt;
Single-line comments are formed in JavaScript by using two consecutive forward slashes //.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//This is a comment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Multi-line Comments&lt;/strong&gt;&lt;br&gt;
Multi-line comments are formed in JavaScript by encircling the lines with /* at the start and */ at the conclusion. Comments are useful for a variety of purposes, such as explaining a code block or offering hints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*  
This is a really long comment
which is referred to as a multi-line
comment. 
*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Strings&lt;/strong&gt;&lt;br&gt;
Strings are the most basic data type.&lt;br&gt;
They're any collection of characters (letters, spaces, numbers, or symbols) encircled by single or double quotations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
`let string = "This article is really good.";
 let string = "JavaScript is the best.";`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Arithmetic Operators&lt;/strong&gt;&lt;br&gt;
JavaScript supports arithmetic operators for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  + addition&lt;/li&gt;
&lt;li&gt;  - subtraction&lt;/li&gt;
&lt;li&gt;  * multiplication&lt;/li&gt;
&lt;li&gt;  / division&lt;/li&gt;
&lt;li&gt;  % modulo
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Addition
2 + 1
// Subtraction
19 - 2
// Multiplication
2 * 25
// Division
49 / 7
// Modulo
100 % 20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Assignment Operators&lt;/strong&gt;&lt;br&gt;
Based on the value of its right operand, an assignment operator assigns a value to its left operand.&lt;br&gt;
Here are a few examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;*= multiplication assignment &lt;/li&gt;
&lt;li&gt;/= division assignment &lt;/li&gt;
&lt;li&gt;+= addition assignment &lt;/li&gt;
&lt;li&gt;-= subtraction assignment
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`let number = 100;
// Both statements will add 10
number = number + 10;
number += 10;
console.log(number); 
// Prints: 120` 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;String Concatenation&lt;/strong&gt;&lt;br&gt;
The + operator in JavaScript can be used to concatenate multiple strings. Multiple strings and variables containing string values have been concatenated in this example. The concatenated string will be stored in the displayText variable when the code block has been executed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let team = 'chelsea';
let opponent = 'arsenal'; 
let displayText = 'Yesterday ' + opponent  + ' was beaten by ' +  team + '.';
console.log(displayText);
// Prints: Yesterday arsenal was beaten by chelsea.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;String Interpolation&lt;/strong&gt;&lt;br&gt;
The technique of evaluating string literals containing one or more placeholders is known as string interpolation (expressions, variables, etc).&lt;br&gt;
It's possible to do it with template literals: text $expression text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let price = 700;
// String concatenation
'The car cost ' + price + ' dollars.';
// String interpolation
`The car cost ${price} dollars.`;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Variables&lt;/strong&gt;&lt;br&gt;
Variables are utilized whenever a piece of data needs to be stored. A variable is a collection of data that can be used elsewhere in the program. Because variables can be used to replace the same value in several locations, they ensure code re-usability.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const name = 'Mwovi';
let age = 21; 
console.log(name + ' is ' + age + ' years old.');
// Prints: Mwovi is 21 years old.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4o3ijzx4ntp6g7zvtjpc.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4o3ijzx4ntp6g7zvtjpc.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These basic JavaScript syntax are enough to get you started on the most popular language on the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Side-Note&lt;/strong&gt;&lt;br&gt;
It is common for people, especially beginners to confuse between java and JavaScript. However as Professor Snape would say, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcoz9pnn5qwiucssbn1qh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcoz9pnn5qwiucssbn1qh.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This would be akin to confusing car and carpet.&lt;br&gt;
Key differences in the two are, Java is an object-oriented programming language, whereas JavaScript is an object-oriented scripting language. Java builds apps that operate in a virtual machine or in a browser, whereas JavaScript is exclusively used in a browser. While Java code must be compiled, JavaScript code is pure text.&lt;/p&gt;

&lt;p&gt;In JavaScript circles such a mistake would cost you your life as you know it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fubekouja2mvephbj02tv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fubekouja2mvephbj02tv.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
