<?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: Odegi Christine </title>
    <description>The latest articles on DEV Community by Odegi Christine  (@odegichristine).</description>
    <link>https://dev.to/odegichristine</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%2F938070%2Fe4d07384-4134-465e-9f38-c5c5e35dcab7.jpeg</url>
      <title>DEV Community: Odegi Christine </title>
      <link>https://dev.to/odegichristine</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/odegichristine"/>
    <language>en</language>
    <item>
      <title>Ultimate Guide to JavaScript</title>
      <dc:creator>Odegi Christine </dc:creator>
      <pubDate>Thu, 01 Dec 2022 15:58:42 +0000</pubDate>
      <link>https://dev.to/odegichristine/ultimate-guide-to-javascript-4fp6</link>
      <guid>https://dev.to/odegichristine/ultimate-guide-to-javascript-4fp6</guid>
      <description>&lt;h2&gt;
  
  
  Arrays
&lt;/h2&gt;

&lt;p&gt;An array is a collection of elements. Arrays are a way to store groups of related data inside a single variable.&lt;br&gt;
Arrays are objects and can store any type of data. Arrays are zero indexed, that is, the first element in an array has an index of 0.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating arrays
&lt;/h2&gt;

&lt;p&gt;Using new keyword&lt;br&gt;
&lt;code&gt;var studentName = new Array("Mary", "Daniel")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Array literal notation&lt;br&gt;
&lt;code&gt;var studentName = Array.of("Mary", "Daniel")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Array literal&lt;br&gt;
Use of square brackets&lt;br&gt;
&lt;code&gt;var studentName = ["Mary", "Daniel"]&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Working with arrays
&lt;/h2&gt;

&lt;p&gt;Adding a new item&lt;br&gt;
Use push method: studentName.push("Stacy")&lt;/p&gt;

&lt;p&gt;Removing an item from the list&lt;br&gt;
To remove from the end: studentName.pop()&lt;br&gt;
To remove from the beginning: studentName.shift()&lt;br&gt;
To remove multiple items from the end of an array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ["apple", "orange", "guava"];
const start = -3;
const removedItems = fruits.splice(start)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Joining two or more arrays&lt;br&gt;
Use concat() method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const a = [1,2]
const b = [3,4]
const c = a.concat(b)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finding items in an array&lt;br&gt;
Use find() method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a.find(element, index, array)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Populating arrays&lt;br&gt;
You can create an empty array and add elements to it later. In order to add elements to an array, specify the index number of the element you want to create or modify&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var studentName = [];
studentName[0] = "Lynn";
studentName[1] = "Bryan";
studentName[87] = "Omolo"; //addition does not have to be sequential
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multidimensional arrays&lt;br&gt;
Multiple arrays can be stored in a single array.&lt;br&gt;
An array containing an array is called a multidimensional array. To write a multidimensional array, you add more sets of square brackets to a variable name. e.g:&lt;br&gt;
&lt;code&gt;var ListOfLists [0][0];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Accessing array elements&lt;br&gt;
Use the index number in square brackets.&lt;br&gt;
&lt;code&gt;myArray[2]; //returns third element in the array&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To access elements in a multidimensional array, add more square brackets with the index of the element.&lt;br&gt;
&lt;code&gt;var ListOfLists [0][0];&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  String object
&lt;/h2&gt;

&lt;p&gt;Also known as a string literal and is enclosed in quotes/double quotes.&lt;br&gt;
A string is a sequence of characters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating strings&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;As primitives, i.e from string literals&lt;br&gt;
&lt;code&gt;const name= "Christine";&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As objects&lt;br&gt;
&lt;code&gt;const name= newString("Christine");&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Character access&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;charAt() method&lt;br&gt;
&lt;code&gt;'cat'.charAt(1) //gives value 'a'&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Treating the string as ana array-like object, where individual characters correspond to a numerical index.&lt;br&gt;
&lt;code&gt;'cat'[1] //gives value 'a'&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Determining the length of a string using length property&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'Fabian'.length //6
const name= 'Fabian'
name.length //6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  JavaScript loops
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;While loop&lt;/strong&gt;&lt;br&gt;
We add a condition after the while keyword and a block of code that is run until condition evaluates to false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while (n&amp;lt;3){
    //statements
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;do...while loop&lt;/strong&gt;&lt;br&gt;
Similar to while except that the condition is evaluated after code block is executed.&lt;br&gt;
The block is always executed at least once.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;do{
  //statements
}while (condition)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For loop&lt;/strong&gt;&lt;br&gt;
Uses the for keyword then passes three instructions: initialization, condition, increment part.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (i=0; i&amp;gt;10; i++){
    //statements
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For of loop&lt;/strong&gt;&lt;br&gt;
Developed in 2015. It is a simplified version of for loop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const list= ['a', 'b', 'c']
for (const value of list){
console.log(value) //value
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Objects
&lt;/h2&gt;

&lt;p&gt;An  object is any value not of primitive type(string, number, boolean, symbol, null, undefined).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating objects&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Using object initializers or object literals.&lt;br&gt;
&lt;code&gt;const car= {}&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using constructor function&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Define the object type using a constructor function. Use a capital letter.&lt;/li&gt;
&lt;li&gt;Create an instance of the object using new.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Student(name, regNumber, course){
        this.name = name,
        this.regNumber = regNumber,
        this.course = course
}
const student1 = new Student ("Christine", "SCT211", "B.Sc Computer Science")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order of arguments and parameters should be the same. student1.name is assigned "Christine".&lt;br&gt;
You can add a property to a previously defined object.&lt;br&gt;
&lt;code&gt;student1.age = 22;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;An object can have a property that is another object.&lt;br&gt;
&lt;code&gt;const object = new Object("value1", "value2", object2)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To access a property in object 2:&lt;br&gt;
&lt;code&gt;object.object2.property&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using the Object.create method to create an object from a prototype.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//create an Animal object
var Animal={
   legs: 2,
   type: "mammal",
}
//create a cat object, based on animal.
var cat = Object.create(Animal)
cat.legs=4;
cat.type= "mammal';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Objects and properties&lt;/strong&gt;&lt;br&gt;
Objects have properties associated with them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessing properties&lt;/strong&gt;&lt;br&gt;
Dot notation&lt;br&gt;
&lt;code&gt;student1.name = "Christine";&lt;/code&gt;&lt;br&gt;
Bracket notation&lt;br&gt;
&lt;code&gt;student1["name"]="Christine";&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You cannot use dot notation to access a property whose name is not a valid JavaScript identifier.&lt;br&gt;
For example, a property name that has a space/hyphen, starts with a number or is held inside a variable can only be accessed using bracket notation.&lt;br&gt;
Examples&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = {};
const str = "myString";
const rand = Math.random();
const anotherObj = {};
//create additional properties on myObj
myObj.type = "value1";
myObj["date created"] = "value2"; //key has space
myObj[str] = "value3"; //the key is in a variable str
myObj[rand] = "value4"; //a random number is the key
myObj[anotherObj] = "value5"; //the key is object anotherObj
myobj[" "] = "value6"; //key is an empty string
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Deleting properties&lt;/strong&gt;&lt;br&gt;
Properties can be deleted from objects using delete operator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var myObject={
   var1:"value1",
   var2:"value2",
   var3:"value3"
};
//delete var2 from Object
delete myObject.var2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt;&lt;br&gt;
An object can extend another object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var Person = new Object();
var Val= new Person();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Defining methods&lt;/strong&gt;&lt;br&gt;
A method is a function associated with an object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var Car={
   make:"",
   year:"",
   myCar: function(make, year){
        car.make = make;
        car.year = year;
   }
}
//To call the function;
car.myCar("Ford", 1969);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using &lt;em&gt;this&lt;/em&gt; for object references&lt;/strong&gt;&lt;br&gt;
JavaScript has a special keyword, &lt;em&gt;this&lt;/em&gt;, that you can use within a method to refer to the current object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var Car = {
   make:"",
   year:"",
   myCar: function(make, year){
       this.make = make;
       this.year = year;
   }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Classes
&lt;/h2&gt;

&lt;p&gt;Are a way to define a common pattern for multiple objects.&lt;br&gt;
Name of the class starts with a capital letter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person{
     name
}
const john = new Person();
//john is an instance of the Person class

john.name = "John"  //set value of a property
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Constructor() is a special method used to initialise class properties when a new object instance is created. I can only be used once in a class.&lt;br&gt;
A constructor can use the 'super' keyword to call the constructor of the super class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person{
    constructor(name){
        this.name= name;
    }
    hello(){
       return 'Hello, I am '+this.name+'.';
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Method are defined on the object instance, not on the class.&lt;br&gt;
To execute a method on the class, you define it as static.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person{
    static genericHello(){
        return 'Hello';
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Static properties and methods are called without instantiating their class and cannot be called through a class instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt;&lt;br&gt;
A class can extend another class and objects initialised using that class.&lt;br&gt;
It can also inherit all the methods of both classes.&lt;br&gt;
Suppose we have class Person, we can define a new class Programmer that extends Person.&lt;br&gt;
If we instantiate a new object with class Programmer, it has access to the hello() method&lt;br&gt;
You can reference the parent class in the child class by calling super()&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Programmer extends Person{
     hello(){
        return super.hello() + '. I am also a programmer.';
     }
}
const flavio = new Programmer();
flavio.hello()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>vstech</category>
    </item>
    <item>
      <title>Ultimate Guide to JavaScript</title>
      <dc:creator>Odegi Christine </dc:creator>
      <pubDate>Tue, 08 Nov 2022 21:01:00 +0000</pubDate>
      <link>https://dev.to/odegichristine/ultimate-guide-to-javascript-2dec</link>
      <guid>https://dev.to/odegichristine/ultimate-guide-to-javascript-2dec</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is JavaScript?&lt;/strong&gt;&lt;br&gt;
JavaScript is a programming language that started out as a quick and dirty language created for one of the first web browsers.&lt;br&gt;
It is now the world's most popular programming language. The demand for JavaScript programmers is also on the rise. JavaScript is fairly east to pick up and start using. Learning JavaScript isn't just about the syntax of the language. It's also about accessing the tools and community that has been built around the language.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;History of JavaScript&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;JavaScript was developed in &lt;strong&gt;1995&lt;/strong&gt; for Netscape 2 by &lt;strong&gt;Brandon&lt;/strong&gt; &lt;strong&gt;Eich&lt;/strong&gt;. He wrote it in 10 days by borrowing many of the best features from other programming languages. This rush resulted to a number of mistakes in the language. JavaScript's original name was Mocha which was changed to Livescript by Netscape Navigator in its first beta deployment. In 1995 the name was changed to JavaScript when it was built into Netscape 2 browser. ECMA-262 specification defined standard version of the core JavaScript language.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript is a lightweight, interpreted language.&lt;/li&gt;
&lt;li&gt;It is designed for creating network centric apps.&lt;/li&gt;
&lt;li&gt;It is complimentary to and integrated with Java.&lt;/li&gt;
&lt;li&gt;Its is complimentary to and integrated with HTML.&lt;/li&gt;
&lt;li&gt;Open and cross platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Over the years, JavaScript grew and became a very popular way to make web pages more dynamic. Dynamic HTML was an early result of JavaScript being built into web browsers. It enables cool effects such as the falling snowflake effect, pop-up windows, curling web page corners, drop-down menus and form validation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;General uses of JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used to create websites&lt;/li&gt;
&lt;li&gt;Used to create web applications&lt;/li&gt;
&lt;li&gt;Used to create serverside apps using Node.js,&lt;/li&gt;
&lt;li&gt;Used to create mobile apps&lt;/li&gt;
&lt;li&gt;Used to create programs for microcontrollers and Internet of Things&lt;/li&gt;
&lt;li&gt;Used to create smartwatch applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Uses of JavaScript on the web&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nifty effects&lt;/li&gt;
&lt;li&gt;Input validation&lt;/li&gt;
&lt;li&gt;Rollover effects&lt;/li&gt;
&lt;li&gt;Drop-down/Flyout menus&lt;/li&gt;
&lt;li&gt;Drag and drop features&lt;/li&gt;
&lt;li&gt;Infinitely scrolling web pages&lt;/li&gt;
&lt;li&gt;Autocomplete&lt;/li&gt;
&lt;li&gt;Progress bars&lt;/li&gt;
&lt;li&gt;Tabs within web pages&lt;/li&gt;
&lt;li&gt;Sortable lists&lt;/li&gt;
&lt;li&gt;Magic zoom&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JavaScript is the standard for creating dynamic user interfaces for the web. Because of its power and ability to run in any web browser, JavaScript coding is the most popular and necessary skill for a modern web developer to have.&lt;/p&gt;
&lt;h2&gt;
  
  
  Client-sided JavaScript
&lt;/h2&gt;

&lt;p&gt;Is the most common form of the language. It adds interactivity to the web pages by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;controlling the browser itself or making use of the functionality of the browser.&lt;/li&gt;
&lt;li&gt;manipulating the structure and content of the web pages&lt;/li&gt;
&lt;li&gt;manipulating the styles (fonts and layout) of web pages&lt;/li&gt;
&lt;li&gt;accessing data from other sources&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript is case sensitive. For example, Jscript and jScript are two different things&lt;/li&gt;
&lt;li&gt;JavaScript doesn't care much about whitespace, which includes spaces, tabs, line breaks but can be used to increase readability of the code.&lt;/li&gt;
&lt;li&gt;Semicolons- these are used at the end of statements.&lt;/li&gt;
&lt;li&gt;Reserved words- these are words with special meaning to the JavaScript interpreter and cannot be used as variables, functions, methods, loop labels or any object names.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Comments
&lt;/h2&gt;

&lt;p&gt;Comments enable you to explain what a certain line of code does. Comments are of two types, i.e, single line comments and multiline comments.&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 an example of a single line comment
/*this is the structure of a multiline comment
 *any piece of code within this will not be executed
*/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running JavaScript in a web browser
&lt;/h2&gt;

&lt;p&gt;There are various ways in which this can be achieved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Using JavaScript in a HTML event attribute&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button id="bigButton" onclick="alert('Hello World!');"&amp;gt;Click Here&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Using JavaScript in a script element&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script&amp;gt;
       insert your JavaScript code here
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Including external JavaScript files&lt;/strong&gt;&lt;br&gt;
This is the most popular method with the following benefits:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keeps HTML files neater and less cluttered&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Makes life easier because you only need to modify JavaScript in only one place when something changes or when fixing a bug.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="lesson1.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;A variable is a container that holds data.&lt;br&gt;
There are two types of variables: global variable and local variable.&lt;br&gt;
Declaring a variable is the process of first creating a variable in a program.&lt;br&gt;
A variable can either be created without a keyword or with a keyword.&lt;br&gt;
How to create variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//An example of how to create variables
var myName; //with a var keyword
myName="Ken"; //without a var keyword
const num1=6; //const keyword is used to declare a constant,i.e, values that cannot be changed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Data types in JavaScript
&lt;/h2&gt;

&lt;p&gt;JavaScript recognizes five basic types of data&lt;br&gt;
&lt;strong&gt;Number data type&lt;/strong&gt;&lt;br&gt;
Numbers in JavaScript are stored as 64-bit, floating point values.&lt;br&gt;
&lt;strong&gt;Number functions&lt;/strong&gt;- converts values to numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Number("42"); //returns the number 42
Number(true); //returns 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;parseInt() function&lt;/strong&gt;- in JavaScript all numbers are floating point. When parseInt is used, only the non-fractional part is considered.&lt;br&gt;
&lt;code&gt;parseInt(300.045); //returns 300&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;parsefloat() function&lt;/strong&gt;- tells JavaScript to treat a number as a float.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;String data type&lt;/strong&gt;&lt;br&gt;
A string can be made up of any characters i.e letters, numbers and punctuations.&lt;br&gt;
JavaScript strings are immutable, that is, they cannot be modified.&lt;br&gt;
The length of a string is the number of UTF-16 code units in it.&lt;br&gt;
&lt;strong&gt;String functions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;charAt()- produces the character at a specified position.&lt;/li&gt;
&lt;li&gt;concat()- combines one or more strings and returns an incorporated string&lt;/li&gt;
&lt;li&gt;indexOf()- searches and returns the position of the first occurrence of the searched character or substring within the string.&lt;/li&gt;
&lt;li&gt;split()- splits strings into an array of substrings.&lt;/li&gt;
&lt;li&gt;substr()- extracts a portion of a string beginning at "start" through a specified length.&lt;/li&gt;
&lt;li&gt;substring()- extracts the characters within a string between two specified positions.&lt;/li&gt;
&lt;li&gt;toLowerCase()- produces the string with all of its characters converted to lowercase.&lt;/li&gt;
&lt;li&gt;toUpperCase()- produces the string with all characters converted to uppercase.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Boolean data type&lt;/strong&gt;&lt;br&gt;
Store either true or false.&lt;br&gt;
They are used for conditional operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NaN data type&lt;/strong&gt;&lt;br&gt;
Stands for not a number. This is the result you get when you try to perform a calculation with a string, or when a calculation cannot be done like getting the square root of a negative number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Undefined data type&lt;/strong&gt;&lt;br&gt;
This is the default data type when you don't give a variable a value.&lt;/p&gt;

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