SlideShare a Scribd company logo
QUICK COURSE: JAVASCRIPT ESSENTIALS IN 1 HOUR (2018)
JS
Ahmed Ibrahim
Full Stack Engineer
JAVASCRIPT OVERVIEW
 JavaScript is not Java.
 JavaScript is a programming language for the web.
 provide dynamic interactivity on websites.
 Add new HTML Elements and CSS Selectors to the Web pages.
 User interface enhancements such as menus and dialog boxes, animations, graphics, ……and
many more.
 It Works on The Client Side and The Server Side.
TOOLS
 Text Editors
(Visual Studio Code, Atom, Sublime Text, Notepad++)
 Online Editors
(plunkr, jsfiddle, jsbin, codepen)
 IDE
(Visual Studio, Aptana Studio, WebStorm, Netbeans)
 Browsers
(Chrome, Firefox, Opera, IE)
IMPORTANT
 Is Case Sensitive
( firstMessage != firstmessage )
( while not While or WHILE )
 camelCase
( camelCaseMethod )
 Semicolon ; Required: statements are on the same line. Example: let i = 1; i++ ;
Optional: After statements . Example: let i = 7; & let myName = “Ahmed”;
Rejected: after Curly Brackets . Example: if () { } & else { } & for () { } & while () { } & function
(arg) { }
INTERNAL & EXTERNAL JAVASCRIPT
Internal Scripts
<!DOCTYPE HTML>
<html>
<head>
<title> First Program </title>
</head>
<body>
<h1>First Heading</h1>
<script>
alert( “ Hi, I’m JavaScript! “ );
</script>
<p>First Paragraph </p>
</body>
</html>
External Scripts
<!DOCTYPE HTML>
<html>
<head>
<title> First Program </title>
</head>
<body>
<h1>First Heading</h1>
<p>First Paragraph </p>
<script src=“script.js” ></script>
</body>
</html>
COMMENTS
// This is one-line comment.
/*
This is a multiline comment.
*/
VARIABLES
 let
let myVariable = “Ahmed”;
console.log(myVariable); // ”Ahmed”
let myVariable = 4+3;
Console.log(myVariable); // 7
 const
const MY_VARIABLE = 8;
console.log(MY_VARIABLE); // 8
DATA TYPES
 String ( let myVariable = “Ahmed” ; )
 Number ( let myVariable = 7 ; )
 Boolean ( let myVariable = false; )
 Arrays ( let myArr = [1, true, “name”] )
 Objects ( let myObj = { firstName: “name”, age: 35 } )
LOOPS & CONDITIONAL STATEMENTS
o Conditional Statements
 Ternary Operator
 If
 switch
oLoops
 While
 For
 Do While
TERNARY OPERTATOR
let yourAge = 18;
let acceptedAge = (yourAge > 20) ? true : false;
console.log(acceptedAge);
// false
IF STATEMENT
let myVar = 4;
if (myVar < 4) {
console.log(“It’s less than Four”);
} else if (myVar > 4) {
console.log( “It’s Four”);
} else {
console.log( “It’s Four” );
}
// “It’s Four”
WHILE
let i = 1;
while (i < 4) {
console.log(i);
i++;
}
// 1, 2, 3
DO WHILE
let i = 1;
do {
console.log(i);
i++;
} while (i < 4);
// 1, 2, 3
FOR
for (let i = 0; i < 4; i++) {
console.log(i);
}
// 1, 2, 3
SWITCH
let x = 2;
switch (x) {
case 1:
console.log(“case 1”);
break;
case 2:
console.log( “case 2” );
break;
default:
console.log( “default case" );
}
// “case 2”
ARRAYS
let myArray = [1, 2, 3, 4];
console.log(myArray[0]) // 1
myArray.push(“Ahmed”);
Console.log(myArray) // [1, 2, 3, 4, “Ahmed”]
let removedItem = myArray.splice(pos, 1); // [2, 3, 4 , “Ahmed”]
 pop, push, shift, unshift, length, ………
OBJECTS
let newPerson = {
firstName: “Ahmed”,
lastName: “Ibrahim”,
address: “123”
}
console.log(newPerson.firstName); // “Ahmed”
FUNCTIONS
function addition(x, y) {
let result = x + y;
return result;
}
console.log(addition(2,3)); // 5
console.log(addition(7,1)); // 8
CLOSURES
 A closure is a function having access to the parent scope, even after the parent function has closed.
function newFunc() {
let name = “Ahmed”;
function display() {
console.log(name);
}
return display;
}
var myFunc = newFunc();
myFunc();
DOM (DOCUMENT OBJECT MODEL)
o DOM Methods
 document.getElementById()
 document.getElementsByTagName()
 document.getElementsByClassName()
 document.querySelectorAll()
 document.querySelector()
 addEventListener()
 setAttribute()
 getAttribute()
DOM (DOCUMENT OBJECT MODEL)
o EVENTS
 onmousemown occurs when a user presses a mouse button over an element.
 onclick occurs when the user clicks on an element
 onblur occurs when an object loses focus.
 onmouseover occurs when the pointer is moved onto an element
 onmouseout occurs when a user moves the mouse pointer out of an element
 onmousemove occurs when the pointer is moving while it is over an element.
 onfocus occurs when an element gets focus
 onload occurs when an object has loaded
REGULAR EXPRESSIONS
o FORMAT
 let RegEx = /patterns/modifiers;
 let reg1 = new RegExp("abc");
let reg2 = /abc/;
o CHARACTERS
 ^ Start of string.
 $ End of string.
 a* Zero or more of a.
 a+ One or more of a.
 a{2} Exactly 2 of a.
 a{2,} 2 or more of a.
 a{2,5} Between 2 and 5 of a.
REGULAR EXPRESSIONS
 d Any digit character.
 w An alphanumeric character (“word character”).
 s Any whitespace character (space, tab, newline, and similar).
 D A character that is not a digit.
 W A nonalphanumeric character.
 t Matches a horizontal tab.
 S A nonwhitespace character.
 0 Matches a NUL character.
 . Any character except for newline.
REGULAR EXPRESSIONS
o RegEx MODIFIERS
 /g Global matching
 /i Case insensitive
 /u Unicode; treat pattern as a sequence of Unicode code points
 /s Single line mode
 /m Multi line mode
REGULAR EXPRESSIONS METHODS
 search
 test
 replace
 exec
 split
 match

More Related Content

What's hot (20)

PDF
Understanding Asynchronous JavaScript
jnewmanux
 
PPTX
JavaScript Basics and Trends
Kürşad Gülseven
 
PDF
JavaScript for real men
Ivano Malavolta
 
PDF
Advanced realm in swift
Yusuke Kita
 
PDF
High Performance web apps in Om, React and ClojureScript
Leonardo Borges
 
PPTX
JavaScript APIs you’ve never heard of (and some you have)
Nicholas Zakas
 
PPTX
Functional Reactive Programming (FRP): Working with RxJS
Oswald Campesato
 
PPTX
JavaScript Promises
L&T Technology Services Limited
 
PDF
Useful and Practical Functionalities in Realm
Yusuke Kita
 
PDF
Getting Comfortable with JS Promises
Asa Kusuma
 
PDF
Practical JavaScript Promises
Asa Kusuma
 
PPTX
Promises, Promises
Domenic Denicola
 
PDF
Callbacks, promises, generators - asynchronous javascript
Łukasz Kużyński
 
PDF
The Ring programming language version 1.3 book - Part 30 of 88
Mahmoud Samir Fayed
 
PPTX
Intro to Javascript
Anjan Banda
 
PPTX
Javascript And J Query
itsarsalan
 
PDF
JavaScript Best Pratices
ChengHui Weng
 
PPTX
Java Script Promise
Alok Guha
 
PDF
Even more java script best practices
ChengHui Weng
 
PDF
Csharp_Chap04
Mohamed Krar
 
Understanding Asynchronous JavaScript
jnewmanux
 
JavaScript Basics and Trends
Kürşad Gülseven
 
JavaScript for real men
Ivano Malavolta
 
Advanced realm in swift
Yusuke Kita
 
High Performance web apps in Om, React and ClojureScript
Leonardo Borges
 
JavaScript APIs you’ve never heard of (and some you have)
Nicholas Zakas
 
Functional Reactive Programming (FRP): Working with RxJS
Oswald Campesato
 
JavaScript Promises
L&T Technology Services Limited
 
Useful and Practical Functionalities in Realm
Yusuke Kita
 
Getting Comfortable with JS Promises
Asa Kusuma
 
Practical JavaScript Promises
Asa Kusuma
 
Promises, Promises
Domenic Denicola
 
Callbacks, promises, generators - asynchronous javascript
Łukasz Kużyński
 
The Ring programming language version 1.3 book - Part 30 of 88
Mahmoud Samir Fayed
 
Intro to Javascript
Anjan Banda
 
Javascript And J Query
itsarsalan
 
JavaScript Best Pratices
ChengHui Weng
 
Java Script Promise
Alok Guha
 
Even more java script best practices
ChengHui Weng
 
Csharp_Chap04
Mohamed Krar
 

Similar to JavaScript Essentials in 1 Hour (2018) (20)

PPT
JavaScript - An Introduction
Manvendra Singh
 
PPT
Javascript sivasoft
ch samaram
 
PPTX
Web technologies-course 08.pptx
Stefan Oprea
 
PPTX
JavaScript.pptx
Govardhan Bhavani
 
PDF
05 JavaScript #burningkeyboards
Denis Ristic
 
PDF
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
sharvaridhokte
 
PPTX
Java Script basics and DOM
Sukrit Gupta
 
PPTX
Javascript
D V BHASKAR REDDY
 
PPTX
Java script
bosybosy
 
PPTX
Cordova training : Day 4 - Advanced Javascript
Binu Paul
 
PPTX
Introduction to JavaScrtipt
sesharao puvvada
 
PPTX
Introduction to Client-Side Javascript
Julie Iskander
 
PPT
Javascript
Manav Prasad
 
PPT
Scripting languages
teach4uin
 
PPTX
Java Script
Kalidass Balasubramaniam
 
PDF
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
PPT
Javascript
Vishwa Patel
 
PPTX
Art of Javascript
Tarek Yehia
 
PDF
full javascript Book by Abhishek singh.pdf
AbhishekSingh961152
 
PPTX
Javascript
Gita Kriz
 
JavaScript - An Introduction
Manvendra Singh
 
Javascript sivasoft
ch samaram
 
Web technologies-course 08.pptx
Stefan Oprea
 
JavaScript.pptx
Govardhan Bhavani
 
05 JavaScript #burningkeyboards
Denis Ristic
 
22519 - Client-Side Scripting Language (CSS) chapter 1 notes .pdf
sharvaridhokte
 
Java Script basics and DOM
Sukrit Gupta
 
Javascript
D V BHASKAR REDDY
 
Java script
bosybosy
 
Cordova training : Day 4 - Advanced Javascript
Binu Paul
 
Introduction to JavaScrtipt
sesharao puvvada
 
Introduction to Client-Side Javascript
Julie Iskander
 
Javascript
Manav Prasad
 
Scripting languages
teach4uin
 
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
Javascript
Vishwa Patel
 
Art of Javascript
Tarek Yehia
 
full javascript Book by Abhishek singh.pdf
AbhishekSingh961152
 
Javascript
Gita Kriz
 
Ad

Recently uploaded (20)

PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Ad

JavaScript Essentials in 1 Hour (2018)

  • 1. QUICK COURSE: JAVASCRIPT ESSENTIALS IN 1 HOUR (2018) JS Ahmed Ibrahim Full Stack Engineer
  • 2. JAVASCRIPT OVERVIEW  JavaScript is not Java.  JavaScript is a programming language for the web.  provide dynamic interactivity on websites.  Add new HTML Elements and CSS Selectors to the Web pages.  User interface enhancements such as menus and dialog boxes, animations, graphics, ……and many more.  It Works on The Client Side and The Server Side.
  • 3. TOOLS  Text Editors (Visual Studio Code, Atom, Sublime Text, Notepad++)  Online Editors (plunkr, jsfiddle, jsbin, codepen)  IDE (Visual Studio, Aptana Studio, WebStorm, Netbeans)  Browsers (Chrome, Firefox, Opera, IE)
  • 4. IMPORTANT  Is Case Sensitive ( firstMessage != firstmessage ) ( while not While or WHILE )  camelCase ( camelCaseMethod )  Semicolon ; Required: statements are on the same line. Example: let i = 1; i++ ; Optional: After statements . Example: let i = 7; & let myName = “Ahmed”; Rejected: after Curly Brackets . Example: if () { } & else { } & for () { } & while () { } & function (arg) { }
  • 5. INTERNAL & EXTERNAL JAVASCRIPT Internal Scripts <!DOCTYPE HTML> <html> <head> <title> First Program </title> </head> <body> <h1>First Heading</h1> <script> alert( “ Hi, I’m JavaScript! “ ); </script> <p>First Paragraph </p> </body> </html> External Scripts <!DOCTYPE HTML> <html> <head> <title> First Program </title> </head> <body> <h1>First Heading</h1> <p>First Paragraph </p> <script src=“script.js” ></script> </body> </html>
  • 6. COMMENTS // This is one-line comment. /* This is a multiline comment. */
  • 7. VARIABLES  let let myVariable = “Ahmed”; console.log(myVariable); // ”Ahmed” let myVariable = 4+3; Console.log(myVariable); // 7  const const MY_VARIABLE = 8; console.log(MY_VARIABLE); // 8
  • 8. DATA TYPES  String ( let myVariable = “Ahmed” ; )  Number ( let myVariable = 7 ; )  Boolean ( let myVariable = false; )  Arrays ( let myArr = [1, true, “name”] )  Objects ( let myObj = { firstName: “name”, age: 35 } )
  • 9. LOOPS & CONDITIONAL STATEMENTS o Conditional Statements  Ternary Operator  If  switch oLoops  While  For  Do While
  • 10. TERNARY OPERTATOR let yourAge = 18; let acceptedAge = (yourAge > 20) ? true : false; console.log(acceptedAge); // false
  • 11. IF STATEMENT let myVar = 4; if (myVar < 4) { console.log(“It’s less than Four”); } else if (myVar > 4) { console.log( “It’s Four”); } else { console.log( “It’s Four” ); } // “It’s Four”
  • 12. WHILE let i = 1; while (i < 4) { console.log(i); i++; } // 1, 2, 3
  • 13. DO WHILE let i = 1; do { console.log(i); i++; } while (i < 4); // 1, 2, 3
  • 14. FOR for (let i = 0; i < 4; i++) { console.log(i); } // 1, 2, 3
  • 15. SWITCH let x = 2; switch (x) { case 1: console.log(“case 1”); break; case 2: console.log( “case 2” ); break; default: console.log( “default case" ); } // “case 2”
  • 16. ARRAYS let myArray = [1, 2, 3, 4]; console.log(myArray[0]) // 1 myArray.push(“Ahmed”); Console.log(myArray) // [1, 2, 3, 4, “Ahmed”] let removedItem = myArray.splice(pos, 1); // [2, 3, 4 , “Ahmed”]  pop, push, shift, unshift, length, ………
  • 17. OBJECTS let newPerson = { firstName: “Ahmed”, lastName: “Ibrahim”, address: “123” } console.log(newPerson.firstName); // “Ahmed”
  • 18. FUNCTIONS function addition(x, y) { let result = x + y; return result; } console.log(addition(2,3)); // 5 console.log(addition(7,1)); // 8
  • 19. CLOSURES  A closure is a function having access to the parent scope, even after the parent function has closed. function newFunc() { let name = “Ahmed”; function display() { console.log(name); } return display; } var myFunc = newFunc(); myFunc();
  • 20. DOM (DOCUMENT OBJECT MODEL) o DOM Methods  document.getElementById()  document.getElementsByTagName()  document.getElementsByClassName()  document.querySelectorAll()  document.querySelector()  addEventListener()  setAttribute()  getAttribute()
  • 21. DOM (DOCUMENT OBJECT MODEL) o EVENTS  onmousemown occurs when a user presses a mouse button over an element.  onclick occurs when the user clicks on an element  onblur occurs when an object loses focus.  onmouseover occurs when the pointer is moved onto an element  onmouseout occurs when a user moves the mouse pointer out of an element  onmousemove occurs when the pointer is moving while it is over an element.  onfocus occurs when an element gets focus  onload occurs when an object has loaded
  • 22. REGULAR EXPRESSIONS o FORMAT  let RegEx = /patterns/modifiers;  let reg1 = new RegExp("abc"); let reg2 = /abc/; o CHARACTERS  ^ Start of string.  $ End of string.  a* Zero or more of a.  a+ One or more of a.  a{2} Exactly 2 of a.  a{2,} 2 or more of a.  a{2,5} Between 2 and 5 of a.
  • 23. REGULAR EXPRESSIONS  d Any digit character.  w An alphanumeric character (“word character”).  s Any whitespace character (space, tab, newline, and similar).  D A character that is not a digit.  W A nonalphanumeric character.  t Matches a horizontal tab.  S A nonwhitespace character.  0 Matches a NUL character.  . Any character except for newline.
  • 24. REGULAR EXPRESSIONS o RegEx MODIFIERS  /g Global matching  /i Case insensitive  /u Unicode; treat pattern as a sequence of Unicode code points  /s Single line mode  /m Multi line mode
  • 25. REGULAR EXPRESSIONS METHODS  search  test  replace  exec  split  match