SlideShare a Scribd company logo
JavaScript.pptx
 JavaScript is a dynamic computer programming
language.
 It is an interpreted programming language with
object-oriented capabilities.
 JavaScript was first known as LiveScript.
 JavaScript made its first appearance in Netscape
2.0 in 1995
 The general-purpose core of the language has
been embedded in Netscape, Internet Explorer
and other web browsers.
 Less server interaction: You can validate user input before sending the
page off to the server. This saves server traffic, which means less load
on your server.
 Immediate feedback to the visitors: They don't have to wait for a page
reload to see if they have forgotten to enter something.
 Increased interactivity: You can create interfaces that react when the
user hovers over them with a mouse or activates them via the keyboard.
 Richer interfaces: You can use JavaScript to include such items as
drag-and-drop components and sliders to give a Rich Interface to your
site visitors.
<script language="javascript" type="text/javascript">
JavaScript code
</script>
<noscript>
Sorry JavaScript is not enabled
</noscript>
 Script in <head>...</head> section.
 Script in <body>...</body> section.
 Script in <body>...</body> and <head>...</head>
sections.
 Script in an external file and then include in
<head>...</head> section.
 Three primitive data types:
 Numbers
 Strings
 Boolean
 Undefined
 null
 A variable is named which is used to refer the data.
 Variables are declared with the var keyword.
Example:
var name=“Govardhan”
Note: The value type of a variable can be change during the execution of a
program.
Variable Names:
 Variable name contains alphabets, digits or underscore(_). But
it should not start with a digit.
 You should not use JavaScript reserved keywords as variable
name.
 JavaScript variable names are case-sensitive.
Scope:
 Global variables
 Local variables
abstract debugger final instanceof public transient
boolean default finally int return true
break delete float interfacce short try
byte do for long static typeof
case double function native super var
catch else goto new switch void
char enum if null synchronized volatile
class export implements package this while
const extends import private throw with
continue false in protected throws
Type Operator
Arithmetic + - * / % ++ --
Comparison == != > < >= <=
Logical && || !
Bitwise & | ^ ~ << >> >>>
Assignment = += -= *= /= %=
Miscellaneous ?: typeof
if Statement
if (expression){
/*Statement(s) to be executed if
expression is true*/
}
if…else Statement
if (expression){
/*Statement(s) to be executed if
expression is true*/
}else{
/*Statement(s) to be executed if
expression is false*/
}
if…else if Statement
if (expression 1){
/*Statement(s) to be executed if
expression 1 is true*/
}else if (expression 2){
/*Statement(s) to be executed if
expression 2 is true*/
}else if (expression 3){
/*Statement(s) to be executed if
expression 3 is true*/
}else{
/*Statement(s) to be executed if no
expression is true*/
}
switch Statement
switch (expression){
case condition 1:
statement(s)
break;
case condition 2:
statement(s)
break;
...
case condition n:
statement(s)
break;
default: statement(s)
}
while Statement
while (expression){
/*Statement(s) to be executed if
expression is true*/
}
do…while Statement
do{
/*Statement(s) to be executed;*/
} while (expression);
for Statement
for (initialization; test condition; iteration statement){
/*Statement(s) to be executed if test condition is true*/
}
for…in Statement
for (variablename in object){
/*Statement or block to execute*/
}
for…of Statement
for (variablename of object){
/*Statement or block to execute*/
}
 break
 continue
 JavaScript is an Object-Oriented Programming
Language.
 JavaScript objects are collections of properties i.e.
data or method.
 JavaScript objects are accessed through
references.
Object Data:
objectName.objectProperty = propertyValue;
Object Methods:
objectName.methodName(arguments);
User-Defined Objects:
var objectName = new Object([parameters]);
 Number
 Boolean
 Strings
 Arrays
 Date
 Math
 RegExp
 HTML DOM
 The Array object lets you store multiple values in a single
variable.
Array Method:
 array1.concat(array2);
 array.indexOf(searchElement[, fromIndex]);
 array.join(separator);
 array.push(element1, ..., elementN);
 array.pop();
 array.reverse();
 array.sort( compareFunction );
 A function is a group of reusable code which can
be called anywhere in your program.
Syntax:
function functionName(parametersList){
/*Statement(s)*/
return ;
}
 From version 1.2 onwards JavaScript allows function
definitions to be nested within other functions as well.
Syntax:
function outsideFunctionName(ParametersList){
//Outside funciton block
function insideFunctionName(ParametersList){
//Inside function block
}
}
 You can also define function dynamically using
Function() constructor.
 The unnamed functions created with the
Function() constructor are called anonymous
functions.
Syntax:
var variablename = new Function(arg1,arg2…, FunctionBody);
 JavaScript 1.2 introduces the concept of
function literals which is another new way of
defining unnamed functions.
Syntax:
var variablename = function(ArgumentList){
Function Body
};
 JavaScript's interaction with HTML is handled through events that
occur when the user or the browser manipulates a page.
 The following are some of HTML5 events:
 onload
 onclick
 ondblclick
 onmouseover
 onmouseout
 onchange
 The JavaScript RegExp class represents regular expressions, and
both String and RegExp define methods that use regular
expressions to perform powerful pattern-matching and search-
and-replace functions on text.
Syntax:
var pattern = new RegExp(pattern, attributes);
(or)
var pattern = /pattern/attributes;
TOKEN DESCRIPTION
^ It matches any string at the beginning
$ It matches any string at the end
+ It matches any string containing one or more
* It matches any string containing zero or more
? It matches any string containing at most one
{n} It matches any string containing a sequence of N
[…] Any one character between the brackets
[^…] Any one character not between the brackets
| matches any of the alternatives specified
TOKEN DESCRIPTION
s Matches a whitespace character (space, tab, newline)
S Matches non-whitespace character
d Matches a digit (0-9)
D Matches a non-digit
w Matches a word character (a-z, A-Z, 0-9, _)
W Matches a non-word character
Modifier DESCRIPTION
g Performs a global matchthat is, find all matches rather than stopping
after the first match.
i Perform case-insensitive matching.
m Specifies that if the string has newline or carriage return characters,
the ^ and $ operators will now match against a newline boundary,
instead of a string boundary
METHOD DESCRIPTION SYNTAX
match()
Searches a string for a match against a
regular expression, and returns the
matches, as an Array object.
string.match(regexp)
exec()
Executes a search for a match in its string
parameter.
RegExpObject.exec( string );
test() Tests for a match in its string parameter. RegExpObject.test( string );
toSource()
Returns an object literal representing the
specified object; you can use this value to
create a new object.
RegExpObject.toSource();
toString()
Returns a string representing the specified
object.
RegExpObject.toString();

More Related Content

PPT
Javascript
PPTX
Javascript
PDF
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
PPTX
Introduction to Client-Side Javascript
PPTX
Javascript
PPT
JavaScript - An Introduction
PPT
Javascript
PPT
JavaScript Tutorial
Javascript
Javascript
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
Introduction to Client-Side Javascript
Javascript
JavaScript - An Introduction
Javascript
JavaScript Tutorial

Similar to JavaScript.pptx (20)

PPSX
Javascript variables and datatypes
PPTX
Cordova training : Day 3 - Introduction to Javascript
PPT
Javascript sivasoft
PDF
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
PDF
JavaScript Getting Started
PPTX
JavaScript Fundamentals & JQuery
PPTX
JavaScript.pptx
PPTX
An introduction to javascript
PPTX
Unit III.pptx IT3401 web essentials presentatio
PPTX
Java Script Basic to Advanced For Beginner to Advanced Learner.pptx
PPSX
DIWE - Programming with JavaScript
PPT
Javascript
PPTX
Java script
PPTX
04-JS.pptx
PPTX
04-JS.pptx
PPTX
04-JS.pptx
PPTX
The JavaScript Programming Language
PPTX
Introduction to JavaScrtipt
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
PPTX
javascript client side scripting la.pptx
Javascript variables and datatypes
Cordova training : Day 3 - Introduction to Javascript
Javascript sivasoft
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
JavaScript Getting Started
JavaScript Fundamentals & JQuery
JavaScript.pptx
An introduction to javascript
Unit III.pptx IT3401 web essentials presentatio
Java Script Basic to Advanced For Beginner to Advanced Learner.pptx
DIWE - Programming with JavaScript
Javascript
Java script
04-JS.pptx
04-JS.pptx
04-JS.pptx
The JavaScript Programming Language
Introduction to JavaScrtipt
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
javascript client side scripting la.pptx
Ad

More from Govardhan Bhavani (17)

PPTX
Angular Application Setup.pptx
PPTX
Files.pptx
PPTX
Pandas.pptx
PPTX
NumPy.pptx
PPTX
ExpressJS and REST API.pptx
PPTX
NodeJS.pptx
PPTX
Angular.pptx
PPTX
Maven.pptx
PPTX
Configure & Version Control-Git.pptx
PPTX
DevOps.pptx
PPTX
Agile XP.pptx
PPTX
Unit 1part-2 forms & frames
PPTX
Unit 1 (part-1, basic tags)
Angular Application Setup.pptx
Files.pptx
Pandas.pptx
NumPy.pptx
ExpressJS and REST API.pptx
NodeJS.pptx
Angular.pptx
Maven.pptx
Configure & Version Control-Git.pptx
DevOps.pptx
Agile XP.pptx
Unit 1part-2 forms & frames
Unit 1 (part-1, basic tags)
Ad

Recently uploaded (20)

PPTX
Cell Structure & Organelles in detailed.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
RMMM.pdf make it easy to upload and study
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
GDM (1) (1).pptx small presentation for students
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Lesson notes of climatology university.
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Trump Administration's workforce development strategy
PDF
Complications of Minimal Access Surgery at WLH
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
01-Introduction-to-Information-Management.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Cell Structure & Organelles in detailed.
Abdominal Access Techniques with Prof. Dr. R K Mishra
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Cell Types and Its function , kingdom of life
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
RMMM.pdf make it easy to upload and study
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
GDM (1) (1).pptx small presentation for students
O5-L3 Freight Transport Ops (International) V1.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Lesson notes of climatology university.
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Trump Administration's workforce development strategy
Complications of Minimal Access Surgery at WLH
Supply Chain Operations Speaking Notes -ICLT Program
Yogi Goddess Pres Conference Studio Updates
01-Introduction-to-Information-Management.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
FourierSeries-QuestionsWithAnswers(Part-A).pdf

JavaScript.pptx

  • 2.  JavaScript is a dynamic computer programming language.  It is an interpreted programming language with object-oriented capabilities.
  • 3.  JavaScript was first known as LiveScript.  JavaScript made its first appearance in Netscape 2.0 in 1995  The general-purpose core of the language has been embedded in Netscape, Internet Explorer and other web browsers.
  • 4.  Less server interaction: You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server.  Immediate feedback to the visitors: They don't have to wait for a page reload to see if they have forgotten to enter something.  Increased interactivity: You can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard.  Richer interfaces: You can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.
  • 5. <script language="javascript" type="text/javascript"> JavaScript code </script> <noscript> Sorry JavaScript is not enabled </noscript>
  • 6.  Script in <head>...</head> section.  Script in <body>...</body> section.  Script in <body>...</body> and <head>...</head> sections.  Script in an external file and then include in <head>...</head> section.
  • 7.  Three primitive data types:  Numbers  Strings  Boolean  Undefined  null
  • 8.  A variable is named which is used to refer the data.  Variables are declared with the var keyword. Example: var name=“Govardhan” Note: The value type of a variable can be change during the execution of a program.
  • 9. Variable Names:  Variable name contains alphabets, digits or underscore(_). But it should not start with a digit.  You should not use JavaScript reserved keywords as variable name.  JavaScript variable names are case-sensitive. Scope:  Global variables  Local variables
  • 10. abstract debugger final instanceof public transient boolean default finally int return true break delete float interfacce short try byte do for long static typeof case double function native super var catch else goto new switch void char enum if null synchronized volatile class export implements package this while const extends import private throw with continue false in protected throws
  • 11. Type Operator Arithmetic + - * / % ++ -- Comparison == != > < >= <= Logical && || ! Bitwise & | ^ ~ << >> >>> Assignment = += -= *= /= %= Miscellaneous ?: typeof
  • 12. if Statement if (expression){ /*Statement(s) to be executed if expression is true*/ } if…else Statement if (expression){ /*Statement(s) to be executed if expression is true*/ }else{ /*Statement(s) to be executed if expression is false*/ }
  • 13. if…else if Statement if (expression 1){ /*Statement(s) to be executed if expression 1 is true*/ }else if (expression 2){ /*Statement(s) to be executed if expression 2 is true*/ }else if (expression 3){ /*Statement(s) to be executed if expression 3 is true*/ }else{ /*Statement(s) to be executed if no expression is true*/ } switch Statement switch (expression){ case condition 1: statement(s) break; case condition 2: statement(s) break; ... case condition n: statement(s) break; default: statement(s) }
  • 14. while Statement while (expression){ /*Statement(s) to be executed if expression is true*/ } do…while Statement do{ /*Statement(s) to be executed;*/ } while (expression);
  • 15. for Statement for (initialization; test condition; iteration statement){ /*Statement(s) to be executed if test condition is true*/ } for…in Statement for (variablename in object){ /*Statement or block to execute*/ } for…of Statement for (variablename of object){ /*Statement or block to execute*/ }
  • 17.  JavaScript is an Object-Oriented Programming Language.  JavaScript objects are collections of properties i.e. data or method.  JavaScript objects are accessed through references.
  • 18. Object Data: objectName.objectProperty = propertyValue; Object Methods: objectName.methodName(arguments); User-Defined Objects: var objectName = new Object([parameters]);
  • 19.  Number  Boolean  Strings  Arrays  Date  Math  RegExp  HTML DOM
  • 20.  The Array object lets you store multiple values in a single variable. Array Method:  array1.concat(array2);  array.indexOf(searchElement[, fromIndex]);  array.join(separator);  array.push(element1, ..., elementN);  array.pop();  array.reverse();  array.sort( compareFunction );
  • 21.  A function is a group of reusable code which can be called anywhere in your program. Syntax: function functionName(parametersList){ /*Statement(s)*/ return ; }
  • 22.  From version 1.2 onwards JavaScript allows function definitions to be nested within other functions as well. Syntax: function outsideFunctionName(ParametersList){ //Outside funciton block function insideFunctionName(ParametersList){ //Inside function block } }
  • 23.  You can also define function dynamically using Function() constructor.  The unnamed functions created with the Function() constructor are called anonymous functions. Syntax: var variablename = new Function(arg1,arg2…, FunctionBody);
  • 24.  JavaScript 1.2 introduces the concept of function literals which is another new way of defining unnamed functions. Syntax: var variablename = function(ArgumentList){ Function Body };
  • 25.  JavaScript's interaction with HTML is handled through events that occur when the user or the browser manipulates a page.  The following are some of HTML5 events:  onload  onclick  ondblclick  onmouseover  onmouseout  onchange
  • 26.  The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search- and-replace functions on text. Syntax: var pattern = new RegExp(pattern, attributes); (or) var pattern = /pattern/attributes;
  • 27. TOKEN DESCRIPTION ^ It matches any string at the beginning $ It matches any string at the end + It matches any string containing one or more * It matches any string containing zero or more ? It matches any string containing at most one {n} It matches any string containing a sequence of N […] Any one character between the brackets [^…] Any one character not between the brackets | matches any of the alternatives specified
  • 28. TOKEN DESCRIPTION s Matches a whitespace character (space, tab, newline) S Matches non-whitespace character d Matches a digit (0-9) D Matches a non-digit w Matches a word character (a-z, A-Z, 0-9, _) W Matches a non-word character
  • 29. Modifier DESCRIPTION g Performs a global matchthat is, find all matches rather than stopping after the first match. i Perform case-insensitive matching. m Specifies that if the string has newline or carriage return characters, the ^ and $ operators will now match against a newline boundary, instead of a string boundary
  • 30. METHOD DESCRIPTION SYNTAX match() Searches a string for a match against a regular expression, and returns the matches, as an Array object. string.match(regexp) exec() Executes a search for a match in its string parameter. RegExpObject.exec( string ); test() Tests for a match in its string parameter. RegExpObject.test( string ); toSource() Returns an object literal representing the specified object; you can use this value to create a new object. RegExpObject.toSource(); toString() Returns a string representing the specified object. RegExpObject.toString();