Posts

React Introduction

Image
  What is React? React is a JavaScript library (not a framework) that creates user interfaces (UIs) in a predictable and efficient way using declarative code . You can use it to help build single page applications and mobile apps, or to build complex apps if you utilize it with other libraries   React.JS History Facebook Software Engineer, Jordan Walke, created it. React.JS was first used in 2011 for Facebook's News feed feature. The create-react-app version 2.0 package was released in October 2018. Initial Release to the Public (V0.3.0) was in July 2013. Create-react-app version 2.0 supports Babel 7, webpack 4, and Jest23. Current version of React.JS is 17.0.1 (October 22, 2020).   Setting up a React Environment Install create-react-app by running this command in your terminal: sudo wget -qO- https://deb.nodesource.com/setup_14.x | sudo -E bash sudo apt-get install -y nodejs node -v npm -v Run this command to create a React application na...

JavaScript While Loop

Image
  The While Loop The while loop loops through a block of code as long as a specified condition is true. Syntax while ( condition ) { // code block to be executed } < !DOCTYPE html > < html > < p id ="demo" > JavaScript While Loop < /p > < script > var txt = "" ; var i=0; while (i < 10 ) {   text += "The number is " + i;   i++; } document.getElementById( "demo" ).innerHTML = text; < /script >     < /body > < /html >     The Do/While Loop The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true. Syntax do { // code block to be executed } while ( condition ); < !DOCTYPE html > < html > < p id ="demo" > JavaScript Do/While Loop < /p > < script > var txt = ...

JavaScript For Loop

Image
  JavaScript Loops Loops are handy, if you want to run the same code over and over again, each time with a different value. Often this is the case when working with arrays: text += cars[ 0 ] + "<br>" ; text += cars[ 1 ] + "<br>" ; text += cars[ 2 ] + "<br>" ; text += cars[ 3 ] + "<br>" ; text += cars[ 4 ] + "<br>" ; text += cars[ 5 ] + "<br>" ; < !DOCTYPE html > < html > < p id ="demo" > JavaScript can change HTML content. < /p > < script >  var cars = [ "BMW" , "Volvo" , "Saab" , "Ford" , "Fiat" , "Audi" ]; var text = "" ; var i; for (i = 0 ; i < cars. length ; i++) {   text += cars[i] + "<br>" ; }  document. getElementById ( "demo" ). innerHTML = text;   < /script >     < /body > < /html >   ...

JavaScript

Image
  What is JavaScript and Why it is Used? JavaScript is a programming language . Used both on the client-side and server-side that allows you to make web pages interactive. Where HTML and CSS are language that give structure and style to web pages,JavaScript gives web pages ,JavaScript gives web pages interactive elements that engage a user. J avaScript can change HTML content one of many JavaScript HTML methods is getElenentById( ). the example below “finds” an HTML elements(with id=”demo” and change the elements content (innerHTML) to “Hello JavaScript”.   < !DOCTYPE html > < html > < p id ="demo" > JavaScript can change HTML content. < /p > < button type ="button" onclick ="document.getElementById("demo"),innerHTML="Hello Javascript!" > Click me < /button > < /body > < /html >   The < script > tag...