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

PPTX
JAVASCRIPT - LinkedIn
DOCX
PPTX
Basics of Javascript
PDF
PDF
Javascript basics
PPTX
Introduction to java script
PDF
Javascript tutorial basic for starter
PPTX
Introduction to Javascript
JAVASCRIPT - LinkedIn
Basics of Javascript
Javascript basics
Introduction to java script
Javascript tutorial basic for starter
Introduction to Javascript

Similar to Introduction to javascript.ppt (20)

PPTX
javascriptbasicsPresentationsforDevelopers
PPTX
Java script.pptx v
PPTX
Unit III.pptx IT3401 web essentials presentatio
PDF
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
PPTX
1. java script language fundamentals
RTF
Java scripts
PDF
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
PDF
Javascript - Tutorial
PDF
java-scriptcdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc ...
PDF
Javascript part1
PDF
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
PDF
any things about myself and that css tble
PPT
Java script final presentation
PPT
Html JavaScript and CSS
PPTX
Java script
PPT
JavaScripttttttttttttttttttttttttttttttttttttttt.ppt
PPTX
Unit 3-Javascript.pptx
PDF
Client sidescripting javascript
javascriptbasicsPresentationsforDevelopers
Java script.pptx v
Unit III.pptx IT3401 web essentials presentatio
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
1. java script language fundamentals
Java scripts
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
Javascript - Tutorial
java-scriptcdvcx vnbm,azsdfghjkml;sxdfcgmndxfcgvhb nmfctgvbhjnm ,cfgvb nm,xc ...
Javascript part1
JavaScript Notes 🔥.pdfssssssssssssssssssssssssssssssssssssssssss
any things about myself and that css tble
Java script final presentation
Html JavaScript and CSS
Java script
JavaScripttttttttttttttttttttttttttttttttttttttt.ppt
Unit 3-Javascript.pptx
Client sidescripting javascript
Ad

Recently uploaded (20)

PPTX
Onica Farming 24rsclub profitable farm business
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Open folder Downloads.pdf yes yes ges yes
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Business Ethics Teaching Materials for college
PDF
From loneliness to social connection charting
PPTX
Introduction and Scope of Bichemistry.pptx
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
Onica Farming 24rsclub profitable farm business
Module 3: Health Systems Tutorial Slides S2 2025
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Open folder Downloads.pdf yes yes ges yes
O5-L3 Freight Transport Ops (International) V1.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
human mycosis Human fungal infections are called human mycosis..pptx
Cardiovascular Pharmacology for pharmacy students.pptx
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Anesthesia in Laparoscopic Surgery in India
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
O7-L3 Supply Chain Operations - ICLT Program
Business Ethics Teaching Materials for college
From loneliness to social connection charting
Introduction and Scope of Bichemistry.pptx
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
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.