SlideShare a Scribd company logo
1 of 30
 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

Similar to JavaScript: Intro to Dynamic Programming Language

javascript
javascript javascript
javascript Kaya Ota
 
ParaSail
ParaSail  ParaSail
ParaSail AdaCore
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript BootcampAndreCharland
 
The Java Script Programming Language
The  Java Script  Programming  LanguageThe  Java Script  Programming  Language
The Java Script Programming Languagezone
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoobirbal
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming LanguageRaghavan Mohan
 
Les origines de Javascript
Les origines de JavascriptLes origines de Javascript
Les origines de JavascriptBernard Loire
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginnersAbishek Purushothaman
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascriptMD Sayem Ahmed
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript poojanov04
 

Similar to JavaScript: Intro to Dynamic Programming Language (20)

javascript
javascript javascript
javascript
 
Javascript
JavascriptJavascript
Javascript
 
Javascript
JavascriptJavascript
Javascript
 
Intro to Scala
 Intro to Scala Intro to Scala
Intro to Scala
 
ParaSail
ParaSail  ParaSail
ParaSail
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
Java
JavaJava
Java
 
Java script basics
Java script basicsJava script basics
Java script basics
 
The Java Script Programming Language
The  Java Script  Programming  LanguageThe  Java Script  Programming  Language
The Java Script Programming Language
 
Javascript by Yahoo
Javascript by YahooJavascript by Yahoo
Javascript by Yahoo
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Javascript
JavascriptJavascript
Javascript
 
Les origines de Javascript
Les origines de JavascriptLes origines de Javascript
Les origines de Javascript
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
js.pptx
js.pptxjs.pptx
js.pptx
 
Python Programming Basics for begginners
Python Programming Basics for begginnersPython Programming Basics for begginners
Python Programming Basics for begginners
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascript
 
copa-ii.pptx
copa-ii.pptxcopa-ii.pptx
copa-ii.pptx
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript
 

More from Govardhan Bhavani (17)

Angular Application Setup.pptx
Angular Application Setup.pptxAngular Application Setup.pptx
Angular Application Setup.pptx
 
Files.pptx
Files.pptxFiles.pptx
Files.pptx
 
Pandas.pptx
Pandas.pptxPandas.pptx
Pandas.pptx
 
NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
ExpressJS and REST API.pptx
ExpressJS and REST API.pptxExpressJS and REST API.pptx
ExpressJS and REST API.pptx
 
NodeJS.pptx
NodeJS.pptxNodeJS.pptx
NodeJS.pptx
 
Angular.pptx
Angular.pptxAngular.pptx
Angular.pptx
 
Maven.pptx
Maven.pptxMaven.pptx
Maven.pptx
 
Configure & Version Control-Git.pptx
Configure & Version Control-Git.pptxConfigure & Version Control-Git.pptx
Configure & Version Control-Git.pptx
 
DevOps.pptx
DevOps.pptxDevOps.pptx
DevOps.pptx
 
Agile XP.pptx
Agile XP.pptxAgile XP.pptx
Agile XP.pptx
 
Ajax
AjaxAjax
Ajax
 
Ruby
RubyRuby
Ruby
 
PHP
PHPPHP
PHP
 
CSS
CSSCSS
CSS
 
Unit 1part-2 forms & frames
Unit 1part-2 forms & framesUnit 1part-2 forms & frames
Unit 1part-2 forms & frames
 
Unit 1 (part-1, basic tags)
Unit 1 (part-1, basic tags)Unit 1 (part-1, basic tags)
Unit 1 (part-1, basic tags)
 

Recently uploaded

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

JavaScript: Intro to Dynamic Programming Language

  • 1.
  • 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();