SlideShare a Scribd company logo
JavaScript Basics
Let’s Start
1. JavaScript is the programming language of the Web.
2. JavaScript is easy to learn
3. JavaScript is the world’s most popular programming Language
Overview
Alert Box in JavaScript
An alert box is used if you want to make sure information comes though to the user.
When an alert box pops up, the user will have to click “OK” .
Syntax:
window.alert(“Text”)
A confirm box is used if we want the user to verify or accept something
When a confirm box pops up, the user will click on “OK” or “Cancel”.
It works on true or false depends on “OK” and “Cancel”.
Syntax:
window.confirm(“Text”)
confirm Box in JavaScript
A Prompt box is used if we want the user to input a value before entering a page.
When a prompt box pops up, the user will have to click on “OK” or “Cancel” to proceed after
entering an input value.
“OK” returns the input value.
“Cancel” returns null
Syntax:
window.prompt(“Text”)
Prompt Box in JavaScript
In JavaScript expression is a valid set of literals , variables , operators that evaluate to a single
value that is an expression.
var x;
let y;
x=8;
y=9;
Let z=x+y;
Fixed values are called as Literals.
Expression in JavaScript
• Arithmetic Operators
• Comparison (Relational) Operators
• Bitwise Operators
• Logical Operators
• Assignment Operators
• Special Operators
Operators in JavaScript
Operator Description Example
+ Addition 10+20 = 30
- Subtraction 20-10 = 10
* Multiplication 10*20 = 200
/ Division 20/10 = 2
% Modulus (Remainder) 20%10 = 0
++ Increment var a=10; a++; Now a = 11
-- Decrement var a=10; a--; Now a = 9
Arithmetic Operators
Comparison Operators
Operator Description Example
== Is equal to 10==20 = false
=== Identical (equal and of same
type)
10==20 = false
!= Not equal to 10!=20 = true
!== Not Identical 20!==20 = false
> Greater than 20>10 = true
>= Greater than or equal to 20>=10 = true
< Less than 20<10 = false
<= Less than or equal to 20<=10 = false
Bitwise Operators
Operator Description Example
& Bitwise AND (10==20 & 20==33) = false
| Bitwise OR (10==20 | 20==33) = false
^ Bitwise XOR (10==20 ^ 20==33) = false
~ Bitwise NOT (~10) = -10
<< Bitwise Left Shift (10<<2) = 40
>> Bitwise Right Shift (10>>2) = 2
>>> Bitwise Right Shift with Zero (10>>>2) = 2
Comparison Operators
Operator Description Example
== Is equal to 10==20 = false
=== Identical (equal and of same
type)
10==20 = false
!= Not equal to 10!=20 = true
!== Not Identical 20!==20 = false
> Greater than 20>10 = true
>= Greater than or equal to 20>=10 = true
< Less than 20<10 = false
<= Less than or equal to 20<=10 = false
Logical Operators
Operator Description Example
&& Logical AND (10==20 && 20==33) = false
|| Logical OR (10==20 || 20==33) = false
! Logical Not !(10==20) = true
Assignment Operators
Operator Description Example
= Assign 10+10 = 20
+= Add and assign var a=10; a+=20; Now a =
30
-= Subtract and assign var a=20; a-=10; Now a = 10
*= Multiply and assign var a=10; a*=20; Now a =
200
/= Divide and assign var a=10; a/=2; Now a = 5
%= Modulus and assign var a=10; a%=2; Now a = 0
Special Operators
Operator Description
(?:) Conditional Operator returns value based on
the condition. It is like if-else.
, Comma Operator allows multiple expressions
to be evaluated as single statement.
delete Delete Operator deletes a property from the
object.
in In Operator checks if object has the given
property
instanceof checks if the object is an instance of given
type
new creates an instance (object)
typeof checks the type of object.
void it discards the expression's return value.
yield checks what is returned in a generator by the
Printing basic outputs
In JavaScript we can display data in following ways:
• Writing into an HTML element, using innerHTML.
• Writing into the HTML output using document.write().
• Writing into an alert box, using window.alert().
• Writing into the browser console, using console.log().
Adavntages of JavaScripts
• Speed
• Simplicity
• Popularity
• Interoperability
• Server Load
• Rich Interfaces
• Extended Functionality
• Versatility
• Less Overhead

More Related Content

Similar to Introduction to JavaScript Scripting Language (20)

Java script.pptx v
Java script.pptx v
22x026
 
JavaScript: Operators and Expressions
JavaScript: Operators and Expressions
LearnNowOnline
 
Introduction to javascript.ppt
Introduction to javascript.ppt
BArulmozhi
 
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
youssefsoulali2
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScript
Rasan Samarasinghe
 
Unit - 4 all script are here Javascript.pptx
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
 
Unit 2.5
Unit 2.5
Abhishek Kesharwani
 
Java scripts
Java scripts
Capgemini India
 
Javascript - Tutorial
Javascript - Tutorial
adelaticleanu
 
JavaScript Operators
JavaScript Operators
Charles Russell
 
itft-Operators in java
itft-Operators in java
Atul Sehdev
 
JavaScript Training in Ambala ! Batra Computer Centre
JavaScript Training in Ambala ! Batra Computer Centre
jatin batra
 
09. session 9 operators and statements
09. session 9 operators and statements
Phúc Đỗ
 
Javascript comparison and logical operators
Javascript comparison and logical operators
Jesus Obenita Jr.
 
13665449.ppt
13665449.ppt
JP Chicano
 
11operator in c#
11operator in c#
Sireesh K
 
JavaScript 1 for high school
JavaScript 1 for high school
jekkilekki
 
JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
WebStackAcademy
 
Learning JavaScript Programming
Learning JavaScript Programming
Hriday Ahmed
 
Ch. 17 FIT5, CIS 110 13F
Ch. 17 FIT5, CIS 110 13F
mh-108
 
Java script.pptx v
Java script.pptx v
22x026
 
JavaScript: Operators and Expressions
JavaScript: Operators and Expressions
LearnNowOnline
 
Introduction to javascript.ppt
Introduction to javascript.ppt
BArulmozhi
 
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
youssefsoulali2
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScript
Rasan Samarasinghe
 
Unit - 4 all script are here Javascript.pptx
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
 
Javascript - Tutorial
Javascript - Tutorial
adelaticleanu
 
itft-Operators in java
itft-Operators in java
Atul Sehdev
 
JavaScript Training in Ambala ! Batra Computer Centre
JavaScript Training in Ambala ! Batra Computer Centre
jatin batra
 
09. session 9 operators and statements
09. session 9 operators and statements
Phúc Đỗ
 
Javascript comparison and logical operators
Javascript comparison and logical operators
Jesus Obenita Jr.
 
11operator in c#
11operator in c#
Sireesh K
 
JavaScript 1 for high school
JavaScript 1 for high school
jekkilekki
 
JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
WebStackAcademy
 
Learning JavaScript Programming
Learning JavaScript Programming
Hriday Ahmed
 
Ch. 17 FIT5, CIS 110 13F
Ch. 17 FIT5, CIS 110 13F
mh-108
 

Recently uploaded (20)

Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
ROLE PLAY: FIRST AID -CPR & RECOVERY POSITION.pptx
Belicia R.S
 
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Ad

Introduction to JavaScript Scripting Language

  • 2. 1. JavaScript is the programming language of the Web. 2. JavaScript is easy to learn 3. JavaScript is the world’s most popular programming Language Overview
  • 3. Alert Box in JavaScript An alert box is used if you want to make sure information comes though to the user. When an alert box pops up, the user will have to click “OK” . Syntax: window.alert(“Text”)
  • 4. A confirm box is used if we want the user to verify or accept something When a confirm box pops up, the user will click on “OK” or “Cancel”. It works on true or false depends on “OK” and “Cancel”. Syntax: window.confirm(“Text”) confirm Box in JavaScript
  • 5. A Prompt box is used if we want the user to input a value before entering a page. When a prompt box pops up, the user will have to click on “OK” or “Cancel” to proceed after entering an input value. “OK” returns the input value. “Cancel” returns null Syntax: window.prompt(“Text”) Prompt Box in JavaScript
  • 6. In JavaScript expression is a valid set of literals , variables , operators that evaluate to a single value that is an expression. var x; let y; x=8; y=9; Let z=x+y; Fixed values are called as Literals. Expression in JavaScript
  • 7. • Arithmetic Operators • Comparison (Relational) Operators • Bitwise Operators • Logical Operators • Assignment Operators • Special Operators Operators in JavaScript
  • 8. Operator Description Example + Addition 10+20 = 30 - Subtraction 20-10 = 10 * Multiplication 10*20 = 200 / Division 20/10 = 2 % Modulus (Remainder) 20%10 = 0 ++ Increment var a=10; a++; Now a = 11 -- Decrement var a=10; a--; Now a = 9 Arithmetic Operators
  • 9. Comparison Operators Operator Description Example == Is equal to 10==20 = false === Identical (equal and of same type) 10==20 = false != Not equal to 10!=20 = true !== Not Identical 20!==20 = false > Greater than 20>10 = true >= Greater than or equal to 20>=10 = true < Less than 20<10 = false <= Less than or equal to 20<=10 = false
  • 10. Bitwise Operators Operator Description Example & Bitwise AND (10==20 & 20==33) = false | Bitwise OR (10==20 | 20==33) = false ^ Bitwise XOR (10==20 ^ 20==33) = false ~ Bitwise NOT (~10) = -10 << Bitwise Left Shift (10<<2) = 40 >> Bitwise Right Shift (10>>2) = 2 >>> Bitwise Right Shift with Zero (10>>>2) = 2
  • 11. Comparison Operators Operator Description Example == Is equal to 10==20 = false === Identical (equal and of same type) 10==20 = false != Not equal to 10!=20 = true !== Not Identical 20!==20 = false > Greater than 20>10 = true >= Greater than or equal to 20>=10 = true < Less than 20<10 = false <= Less than or equal to 20<=10 = false
  • 12. Logical Operators Operator Description Example && Logical AND (10==20 && 20==33) = false || Logical OR (10==20 || 20==33) = false ! Logical Not !(10==20) = true
  • 13. Assignment Operators Operator Description Example = Assign 10+10 = 20 += Add and assign var a=10; a+=20; Now a = 30 -= Subtract and assign var a=20; a-=10; Now a = 10 *= Multiply and assign var a=10; a*=20; Now a = 200 /= Divide and assign var a=10; a/=2; Now a = 5 %= Modulus and assign var a=10; a%=2; Now a = 0
  • 14. Special Operators Operator Description (?:) Conditional Operator returns value based on the condition. It is like if-else. , Comma Operator allows multiple expressions to be evaluated as single statement. delete Delete Operator deletes a property from the object. in In Operator checks if object has the given property instanceof checks if the object is an instance of given type new creates an instance (object) typeof checks the type of object. void it discards the expression's return value. yield checks what is returned in a generator by the
  • 15. Printing basic outputs In JavaScript we can display data in following ways: • Writing into an HTML element, using innerHTML. • Writing into the HTML output using document.write(). • Writing into an alert box, using window.alert(). • Writing into the browser console, using console.log().
  • 16. Adavntages of JavaScripts • Speed • Simplicity • Popularity • Interoperability • Server Load • Rich Interfaces • Extended Functionality • Versatility • Less Overhead