Posts

Showing posts from September, 2020

For Loop in JavaScript

 ------------------------------------------- index.html ............................................................................. <! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title > Document </ title > </ head > < body > < h1 > This is tutorial </ h1 > </ body > < script src = "Script.js" ></ script > </ html > ------------------------------------------------------------------------------------------ -------------------------------------- Script.js. -------------------------------- console . log ( 'tutorial for for loop ' ) for ( let i = 0 ; i < 60 ; i ++) { console . log ( i ) }

JavaScript if Else

-------------------------------------------index.html ----------------------------------------------- <! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title > Document </ title > </ head > < body > < h1 > This is tutorial </ h1 > </ body > < script src = "Script.js" ></ script > </ html > ---------------------------------- Script.js ---------------------------------------- console . log ( 'this is tutorial for if else condition' ); const age = 55 ; if ( age == 55 ) { console . log ( 'Age is 55' ) } else if ( age == 30 ) { console . log ( 'age is 30' ) } else { console . log ( 'age is not 28' ) }

JavaScript Arrays and Objects

 ----------------------------------------------------- index.html ---------------------------------------------- index.html tut6.js <! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < title > Document </ title > </ head > < body > < h1 > This is tutorial </ h1 > </ body > < script src = "tut6.js" ></ script > </ html > --------------------------------------------------------------------------------- ------------------------------------------------ tut6.js ----------------------- const marks = [ 12 , 3 3 , 5 4 , 5 3 , 8 3 , 9 5 ]; const fruits = [ 'orange' , 'apple' , 'Pineapple' ]; const arr = new Array ( 23 , 123 , 21 , 'Orange' ); console . log ( marks ); console . log ( marks [ 2 ]) ...