SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)
Nicholas Zakas
 
Java Script Promise
Java Script PromiseJava Script Promise
Java Script Promise
Alok Guha
 

Was ist angesagt? (20)

Understanding Asynchronous JavaScript
Understanding Asynchronous JavaScriptUnderstanding Asynchronous JavaScript
Understanding Asynchronous JavaScript
 
JavaScript Basics and Trends
JavaScript Basics and TrendsJavaScript Basics and Trends
JavaScript Basics and Trends
 
JavaScript for real men
JavaScript for real menJavaScript for real men
JavaScript for real men
 
Advanced realm in swift
Advanced realm in swiftAdvanced realm in swift
Advanced realm in swift
 
High Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScriptHigh Performance web apps in Om, React and ClojureScript
High Performance web apps in Om, React and ClojureScript
 
JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)
 
Functional Reactive Programming (FRP): Working with RxJS
Functional Reactive Programming (FRP): Working with RxJSFunctional Reactive Programming (FRP): Working with RxJS
Functional Reactive Programming (FRP): Working with RxJS
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Useful and Practical Functionalities in Realm
Useful and Practical Functionalities in RealmUseful and Practical Functionalities in Realm
Useful and Practical Functionalities in Realm
 
Getting Comfortable with JS Promises
Getting Comfortable with JS PromisesGetting Comfortable with JS Promises
Getting Comfortable with JS Promises
 
Practical JavaScript Promises
Practical JavaScript PromisesPractical JavaScript Promises
Practical JavaScript Promises
 
Promises, Promises
Promises, PromisesPromises, Promises
Promises, Promises
 
Callbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascriptCallbacks, promises, generators - asynchronous javascript
Callbacks, promises, generators - asynchronous javascript
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Javascript And J Query
Javascript And J QueryJavascript And J Query
Javascript And J Query
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
 
Java Script Promise
Java Script PromiseJava Script Promise
Java Script Promise
 
Even more java script best practices
Even more java script best practicesEven more java script best practices
Even more java script best practices
 
Csharp_Chap04
Csharp_Chap04Csharp_Chap04
Csharp_Chap04
 

Ähnlich wie JavaScript Essentials in 1 Hour (2018)

Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action script
Christophe Herreman
 

Ähnlich wie JavaScript Essentials in 1 Hour (2018) (20)

Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Java tutorial PPT
Java tutorial  PPTJava tutorial  PPT
Java tutorial PPT
 
JavaScript Misunderstood
JavaScript MisunderstoodJavaScript Misunderstood
JavaScript Misunderstood
 
Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action script
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript Looping Statements
JavaScript Looping StatementsJavaScript Looping Statements
JavaScript Looping Statements
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Clojure class
Clojure classClojure class
Clojure class
 
Java
JavaJava
Java
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

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