SlideShare a Scribd company logo
Introduction and Operators in
Javascript
by
Mrs. B.Arulmozhi, M.Sc., B.Ed., M.Phil., SET., NET.,
Assistant Professor and Head, Department of Computer
Science and Applications
D.K.M. College for Women, Vellore
Objective
Main objective of this powerpoint, to focus about the
following points.
 What is Script?
 Some Scripting lanugages.
 Uses of script tag
 About Javascript
 How to add javascript
 Operators in Javascript
Script
 A scripting or script language is a programming language for a special
run-time environment that automates the execution of tasks; the tasks could
alternatively be executed one-by-one by a human operator. Scripting
languages are often interpreted, rather than compileds
 JavaScript, PHP, Python, VBScript.
 Applications of Scripting Languages :
 1. To automate certain tasks in a program
 2. Extracting information from a data set
 3. Less code intensive as compared to traditional
programming languages
Uses of <Script> tag
 The <script> tag in HTML is used to define the
client-side script.
 The <script> tag contains the scripting
statements, or it points to an external script
file.
 The JavaScript is mainly used in form
validation, dynamic changes of content,
image manipulation, etc.
Syntax
Syntax:
<script> Script Contents... </script>
Attributes
 Attributes: Many attribute associated with script tag.
 async: It is used to specify the script is executed
asynchronously.
 charset: It is used to specify the character encoding used in an
external script file.
 defer: It is used to specify that the script is executed when the
page has finished parsing.
 src: It is used to specify the URL of an external script file.
 type: It is used to specify the media type of the script.
How to add Javascript
<html>
<body>
<script language = "javascript" type =
"text/javascript">
<!--
document.write("Hello World!")
//-->
</script>
</body>
</html>
Advantage of Javascript
 Speed.
 Simplicity
 Popularity
 Interoperability
 Server Load
 Rich interfaces
 Extended Functionality.
 Versatility
 Updates
DISADVANTAGES OF
JAVASCRIPT
 Client-Side Security. Because the code
executes on the users’ computer, in some
cases it can be exploited for malicious
purposes. This is one reason some people
choose to disable Javascript.
 Browser Support. JavaScript is sometimes
interpreted differently by different browsers.
Whereas server-side scripts will always
produce the same output, client-side scripts
can be a little unpredictable.
 Whitespace and Line Breaks
 JavaScript ignores spaces, tabs, and
newlines that appear in JavaScript programs.
 Semicolons are Optional
 Simple statements in JavaScript are generally
followed by a semicolon character, just as
they are in C, C++, and Java. JavaScript,
however, allows you to omit this semicolon if
each of your statements are placed on a
separate line.
Case Sensitivity
 JavaScript is a case-sensitive language. This
means that the language keywords, variables,
function names, and any other identifiers must
always be typed with a consistent
capitalization of letters.
Data types
 JavaScript allows you to work with primitive
data types −
 Numbers, eg. 123, 120.50 etc.
 Strings of text e.g. "This text string" etc.
 Boolean e.g. true or false.
 Null
 Undefined
Variables
 , JavaScript has variables. Variables can be
thought of as named containers. You can
place data into these containers and then
refer to the data simply by naming the
container.
How to declare variables
<script type = "text/javascript">
<!--
var money, name;
//-->
</script>
Initializing Variables
<script type = "text/javascript">
<!--
var name = "Ali";
var money;
money = 2000.50;
//-->
</script>
Operators
 Arithmetic Operators (+,-,*,/.%)
 Comparison Operators
 Logical (or Relational) Operators
 Assignment Operators
 Conditional (or ternary) Operators
Arithmetic Operators
S.No. Arithmetic Operator & Description
1 + (Addition)Adds two operandsEx: A + B will give 30
2 - (Subtraction)Subtracts the second operand from the first
Ex: A - B will give -10
3 * (Multiplication)Multiply both operands
Ex: A * B will give 200
4 / (Division)Divide the numerator by the denominator
Ex: B / A will give 2
5 % (Modulus)Outputs the remainder of an integer division
Ex: B % A will give 0
6 ++ (Increment)Increases an integer value by one
Ex: A++ will give 11
7 -- (Decrement)Decreases an integer value by one
Ex: A-- will give 9
<html>
<body>
<script type = "text/javascript">
var a = 33;
var b = 10;
var c = "Test";
var linebreak = "<br />";
document.write("a + b = ");
result = a + b;
document.write(result);</script></body>
</html>
Arithmetic Operators
Comparison /Relational Operator & Description
1 = = (Equal) Checks if the value of two operands are equal or not, if yes, then the condition becomes true.
Ex: (A == B) is not true.
2 != (Not Equal) Checks if the value of two operands are equal or not, if the values are not equal, then the condition becomes true.
Ex: (A != B) is true.
3 > (Greater than) Checks if the value of the left operand is greater than the value of the right operand, if yes, then the condition
becomes true. Ex: (A > B) is not true.
4 < (Less than) Checks if the value of the left operand is less than the value of the right operand, if yes, then the condition becomes
true.
Ex: (A < B) is true.
5 >= (Greater than or Equal to) Checks if the value of the left operand is greater than or equal to the value of the right operand, if
yes, then the condition becomes true.
Ex: (A >= B) is not true.
6 <= (Less than or Equal to) Checks if the value of the left operand is less than or equal to the value of the right operand, if yes,
then the condition becomes true.
Ex: (A <= B) is true.

More Related Content

Similar to Introduction to javascript.ppt (20)

PPTX
JAVASCRIPT - LinkedIn
Gino Louie Peña, ITIL®,MOS®
 
PDF
Javascript tutorial basic for starter
Marcello Harford
 
PDF
Unit 2.5
Abhishek Kesharwani
 
PDF
Javascript - Tutorial
adelaticleanu
 
PDF
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
PPTX
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
 
PPT
13665449.ppt
JP Chicano
 
PPT
Javascript
Manav Prasad
 
PPSX
DIWE - Programming with JavaScript
Rasan Samarasinghe
 
PDF
Client sidescripting javascript
Selvin Josy Bai Somu
 
PPTX
JavaScript / Web Engineering / Web Development / html + css + js/presentation
M Sajid R
 
PDF
Lecture17 ie321 dr_atifshahzad_js
Atif Shahzad
 
PPTX
FFW Gabrovo PMG - JavaScript 1
Toni Kolev
 
PDF
internet Chapter 4-JavascripPrepare a ppt of video compression techniques bas...
wabii3179com
 
PPTX
Learning JavaScript Programming
Hriday Ahmed
 
PPTX
Javascript
Gita Kriz
 
PPTX
Introduction to Client-Side Javascript
Julie Iskander
 
PPTX
Basics of Javascript
poojanov04
 
PPTX
Introduction to Javascript
ambuj pathak
 
PDF
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
youssefsoulali2
 
JAVASCRIPT - LinkedIn
Gino Louie Peña, ITIL®,MOS®
 
Javascript tutorial basic for starter
Marcello Harford
 
Javascript - Tutorial
adelaticleanu
 
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
 
13665449.ppt
JP Chicano
 
Javascript
Manav Prasad
 
DIWE - Programming with JavaScript
Rasan Samarasinghe
 
Client sidescripting javascript
Selvin Josy Bai Somu
 
JavaScript / Web Engineering / Web Development / html + css + js/presentation
M Sajid R
 
Lecture17 ie321 dr_atifshahzad_js
Atif Shahzad
 
FFW Gabrovo PMG - JavaScript 1
Toni Kolev
 
internet Chapter 4-JavascripPrepare a ppt of video compression techniques bas...
wabii3179com
 
Learning JavaScript Programming
Hriday Ahmed
 
Javascript
Gita Kriz
 
Introduction to Client-Side Javascript
Julie Iskander
 
Basics of Javascript
poojanov04
 
Introduction to Javascript
ambuj pathak
 
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
youssefsoulali2
 

Recently uploaded (20)

PDF
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.06.25.pdf
TechSoup
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PPTX
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
PDF
I3PM Industry Case Study Siemens on Strategic and Value-Oriented IP Management
MIPLM
 
PDF
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
PPTX
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
PPTX
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PPTX
Light Reflection and Refraction- Activities - Class X Science
SONU ACADEMY
 
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PPTX
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
PPTX
ENGlish 8 lesson presentation PowerPoint.pptx
marawehsvinetshe
 
PPTX
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
PPTX
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
PDF
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PDF
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.06.25.pdf
TechSoup
 
Introduction presentation of the patentbutler tool
MIPLM
 
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
I3PM Industry Case Study Siemens on Strategic and Value-Oriented IP Management
MIPLM
 
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
Light Reflection and Refraction- Activities - Class X Science
SONU ACADEMY
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
ENGlish 8 lesson presentation PowerPoint.pptx
marawehsvinetshe
 
How to Manage Expiry Date in Odoo 18 Inventory
Celine George
 
Iván Bornacelly - Presentation of the report - Empowering the workforce in th...
EduSkills OECD
 
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
Introduction to Indian Writing in English
Trushali Dodiya
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
Lesson 1 : Science and the Art of Geography Ecosystem
marvinnbustamante1
 
Ad

Introduction to javascript.ppt

  • 1. Introduction and Operators in Javascript by Mrs. B.Arulmozhi, M.Sc., B.Ed., M.Phil., SET., NET., Assistant Professor and Head, Department of Computer Science and Applications D.K.M. College for Women, Vellore
  • 2. Objective Main objective of this powerpoint, to focus about the following points.  What is Script?  Some Scripting lanugages.  Uses of script tag  About Javascript  How to add javascript  Operators in Javascript
  • 3. Script  A scripting or script language is a programming language for a special run-time environment that automates the execution of tasks; the tasks could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted, rather than compileds  JavaScript, PHP, Python, VBScript.  Applications of Scripting Languages :  1. To automate certain tasks in a program  2. Extracting information from a data set  3. Less code intensive as compared to traditional programming languages
  • 4. Uses of <Script> tag  The <script> tag in HTML is used to define the client-side script.  The <script> tag contains the scripting statements, or it points to an external script file.  The JavaScript is mainly used in form validation, dynamic changes of content, image manipulation, etc.
  • 5. Syntax Syntax: <script> Script Contents... </script> Attributes  Attributes: Many attribute associated with script tag.  async: It is used to specify the script is executed asynchronously.  charset: It is used to specify the character encoding used in an external script file.  defer: It is used to specify that the script is executed when the page has finished parsing.  src: It is used to specify the URL of an external script file.  type: It is used to specify the media type of the script.
  • 6. How to add Javascript <html> <body> <script language = "javascript" type = "text/javascript"> <!-- document.write("Hello World!") //--> </script> </body> </html>
  • 7. Advantage of Javascript  Speed.  Simplicity  Popularity  Interoperability  Server Load  Rich interfaces  Extended Functionality.  Versatility  Updates
  • 8. DISADVANTAGES OF JAVASCRIPT  Client-Side Security. Because the code executes on the users’ computer, in some cases it can be exploited for malicious purposes. This is one reason some people choose to disable Javascript.  Browser Support. JavaScript is sometimes interpreted differently by different browsers. Whereas server-side scripts will always produce the same output, client-side scripts can be a little unpredictable.
  • 9.  Whitespace and Line Breaks  JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs.  Semicolons are Optional  Simple statements in JavaScript are generally followed by a semicolon character, just as they are in C, C++, and Java. JavaScript, however, allows you to omit this semicolon if each of your statements are placed on a separate line.
  • 10. Case Sensitivity  JavaScript is a case-sensitive language. This means that the language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
  • 11. Data types  JavaScript allows you to work with primitive data types −  Numbers, eg. 123, 120.50 etc.  Strings of text e.g. "This text string" etc.  Boolean e.g. true or false.  Null  Undefined
  • 12. Variables  , JavaScript has variables. Variables can be thought of as named containers. You can place data into these containers and then refer to the data simply by naming the container.
  • 13. How to declare variables <script type = "text/javascript"> <!-- var money, name; //--> </script>
  • 14. Initializing Variables <script type = "text/javascript"> <!-- var name = "Ali"; var money; money = 2000.50; //--> </script>
  • 15. Operators  Arithmetic Operators (+,-,*,/.%)  Comparison Operators  Logical (or Relational) Operators  Assignment Operators  Conditional (or ternary) Operators
  • 16. Arithmetic Operators S.No. Arithmetic Operator & Description 1 + (Addition)Adds two operandsEx: A + B will give 30 2 - (Subtraction)Subtracts the second operand from the first Ex: A - B will give -10 3 * (Multiplication)Multiply both operands Ex: A * B will give 200 4 / (Division)Divide the numerator by the denominator Ex: B / A will give 2 5 % (Modulus)Outputs the remainder of an integer division Ex: B % A will give 0 6 ++ (Increment)Increases an integer value by one Ex: A++ will give 11 7 -- (Decrement)Decreases an integer value by one Ex: A-- will give 9
  • 17. <html> <body> <script type = "text/javascript"> var a = 33; var b = 10; var c = "Test"; var linebreak = "<br />"; document.write("a + b = "); result = a + b; document.write(result);</script></body> </html>
  • 18. Arithmetic Operators Comparison /Relational Operator & Description 1 = = (Equal) Checks if the value of two operands are equal or not, if yes, then the condition becomes true. Ex: (A == B) is not true. 2 != (Not Equal) Checks if the value of two operands are equal or not, if the values are not equal, then the condition becomes true. Ex: (A != B) is true. 3 > (Greater than) Checks if the value of the left operand is greater than the value of the right operand, if yes, then the condition becomes true. Ex: (A > B) is not true. 4 < (Less than) Checks if the value of the left operand is less than the value of the right operand, if yes, then the condition becomes true. Ex: (A < B) is true. 5 >= (Greater than or Equal to) Checks if the value of the left operand is greater than or equal to the value of the right operand, if yes, then the condition becomes true. Ex: (A >= B) is not true. 6 <= (Less than or Equal to) Checks if the value of the left operand is less than or equal to the value of the right operand, if yes, then the condition becomes true. Ex: (A <= B) is true.