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
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
QUARTER 1 WEEK 2 PLOT, POV AND CONFLICTS
KynaParas
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Controller Request and Response in Odoo18
Celine George
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
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.