SlideShare a Scribd company logo
Web Development
JavaScript
• To declare variable in javascript use:
1) var
Ex: var x=5;
2) let
Ex: let x=5;
3) const
Ex: const y=7;
JavaScript String Methods
• String methods help you to work with strings.
1) The length property returns the length of a string.
• To extract part of string use slice(), substring(), substr() functions.
JavaScript String Methods
2) slice(start, end): extracts a part of a string and returns the
extracted part in a new string.
• This example slices out a portion of a string from position 7 to
position 12 (13-1) and the output will be “Banana”.
JavaScript String Methods
3) substring(start, end): is similar to slice() and the difference is that
substring() cannot accept negative indexes.
• This example substring a portion of a string from position 7 to
position 12 (13-1) and the output will be “Banana”.
JavaScript String Methods
4) substr(start, length): is similar to slice() and the difference is that
the second parameter specifies the length of the extracted part.
• This example will print from position 7 to and count 6 characters
after it and the output will be “Banana”.
JavaScript String Methods
• Replacing String content:
5) replace() method : replaces a specified value with another value in
a string.
• This example will replace “Microsoft” with “W3schools”
JavaScript String Methods
• To convert string to UpperCase():
6) toUpperCase() method: will be used to convert string from
lower to upper case.
JavaScript String Methods
• To convert string to lower case():
7) toLowerCase() method: will be used to convert string from
Upper to lower case.
JavaScript String Methods
8) concat() method : joins two or more strings
JavaScript String Methods
9) trim() method : used to remove white spaces from both
sides of a string.
JavaScript String Methods
10) indexof() method : return index of
(position) of the first occurrence of specified
text in string.
•The result of this code will be 7.
JavaScript String Methods
11) lastindexof() method : return index of (position) of the last
occurrence of specified text in string.
• The result of this code will be 21.

More Related Content

PPT
9781305078444 ppt ch08
DOCX
Java scanner, everything you need to know about Java Scanner
PDF
JavaScript - Chapter 10 - Strings and Arrays
PDF
C programming part4
PDF
C programming part4
PPTX
Full Stack Online Course in Marathahalli| AchieversIT
PPTX
JAVASCRIPT PPT [Autosaved].pptx
PPT
JavaScript Objects
9781305078444 ppt ch08
Java scanner, everything you need to know about Java Scanner
JavaScript - Chapter 10 - Strings and Arrays
C programming part4
C programming part4
Full Stack Online Course in Marathahalli| AchieversIT
JAVASCRIPT PPT [Autosaved].pptx
JavaScript Objects

Similar to Web Development_Sec6_Java secriptvvvvv.pdf (20)

PDF
Java programming-examples
PDF
js_class_notes_for_ institute it is very useful for your study.pdf
PPTX
Ch08 - Manipulating Data in Strings and Arrays
PPTX
String.pptxihugyftgrfxdf bnjklihugyfthfgxvhbjihugyfthcgxcgvjhbkipoihougyfctgf...
PPT
Javascript string method
PDF
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
PDF
MATLAB_Introduction RS&GIS training geomatics
PPTX
21CS642 Module 3 Strings PPT.pptx VI SEM CSE
PPTX
javastringexample problems using string class
PPTX
JavaScript.pptx
PPT
Javascript built in String Functions
PDF
Php Map Script Class Reference
PPTX
unit-5 String Math Date Time AI presentation
PPT
9780538745840 ppt ch03
ODP
Best practices in Java
PDF
JCConf 2021 - Java17: The Next LTS
PPTX
Java String Handling
PPT
CSC128_Part_1_WrapperClassesAndStrings_CenBNcj.ppt
PPT
Expresiones regulares, sintaxis y programación en JAVA
PPT
Java căn bản - Chapter9
Java programming-examples
js_class_notes_for_ institute it is very useful for your study.pdf
Ch08 - Manipulating Data in Strings and Arrays
String.pptxihugyftgrfxdf bnjklihugyfthfgxvhbjihugyfthcgxcgvjhbkipoihougyfctgf...
Javascript string method
JavaScript - Chapter 9 - TypeConversion and Regular Expressions
MATLAB_Introduction RS&GIS training geomatics
21CS642 Module 3 Strings PPT.pptx VI SEM CSE
javastringexample problems using string class
JavaScript.pptx
Javascript built in String Functions
Php Map Script Class Reference
unit-5 String Math Date Time AI presentation
9780538745840 ppt ch03
Best practices in Java
JCConf 2021 - Java17: The Next LTS
Java String Handling
CSC128_Part_1_WrapperClassesAndStrings_CenBNcj.ppt
Expresiones regulares, sintaxis y programación en JAVA
Java căn bản - Chapter9
Ad

More from samaghorab (19)

PPTX
Lec-4-CSS-AdvancedAdvanced.Advanced.Advanced..pptx
PPTX
Web Development_Sec6_kkkkkkkkkkkkkkkkkkkkkkkkkJS.pptx
PPTX
L2Web development development development.pptx
PPTX
L2Web-intro to web development in html,css.pptx
PPT
dokumen.tips_synchronization-in-distributed-systems-chapter-6.ppt
PPTX
lec+5+_part+1 cloud .pptx
PPTX
Lecture dkjdljfklllllllllllllllllllllllllllllllllllllllllllll
PDF
Lec+3-Introduction-to-Distributed-Systems.pdf
PDF
Lecture-1-2-+(1).pdf
PPT
Lec_1_Integration.ppt
PPTX
L2Web.pptx
PDF
Chapter+3+-+Normalization.pdf
PDF
L6.pdf
PDF
Lecture-1-2-+(1).pdf
PDF
Intro_to_data_base.pdf
PPT
5941981.ppt
PPTX
programs+ifelse&+for.pptx
PPTX
Bioinformatics-Lec+4-DNADamage-and-Repair.pptx
PPTX
Python_Session05_Homeworkquestions.pptx
Lec-4-CSS-AdvancedAdvanced.Advanced.Advanced..pptx
Web Development_Sec6_kkkkkkkkkkkkkkkkkkkkkkkkkJS.pptx
L2Web development development development.pptx
L2Web-intro to web development in html,css.pptx
dokumen.tips_synchronization-in-distributed-systems-chapter-6.ppt
lec+5+_part+1 cloud .pptx
Lecture dkjdljfklllllllllllllllllllllllllllllllllllllllllllll
Lec+3-Introduction-to-Distributed-Systems.pdf
Lecture-1-2-+(1).pdf
Lec_1_Integration.ppt
L2Web.pptx
Chapter+3+-+Normalization.pdf
L6.pdf
Lecture-1-2-+(1).pdf
Intro_to_data_base.pdf
5941981.ppt
programs+ifelse&+for.pptx
Bioinformatics-Lec+4-DNADamage-and-Repair.pptx
Python_Session05_Homeworkquestions.pptx
Ad

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Complications of Minimal Access Surgery at WLH
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Classroom Observation Tools for Teachers
PPTX
Cell Structure & Organelles in detailed.
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
Pharma ospi slides which help in ospi learning
PDF
RMMM.pdf make it easy to upload and study
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
01-Introduction-to-Information-Management.pdf
Orientation - ARALprogram of Deped to the Parents.pptx
Complications of Minimal Access Surgery at WLH
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Abdominal Access Techniques with Prof. Dr. R K Mishra
Microbial disease of the cardiovascular and lymphatic systems
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Classroom Observation Tools for Teachers
Cell Structure & Organelles in detailed.
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Chinmaya Tiranga quiz Grand Finale.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Pharma ospi slides which help in ospi learning
RMMM.pdf make it easy to upload and study
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
01-Introduction-to-Information-Management.pdf

Web Development_Sec6_Java secriptvvvvv.pdf

  • 2. JavaScript • To declare variable in javascript use: 1) var Ex: var x=5; 2) let Ex: let x=5; 3) const Ex: const y=7;
  • 3. JavaScript String Methods • String methods help you to work with strings. 1) The length property returns the length of a string. • To extract part of string use slice(), substring(), substr() functions.
  • 4. JavaScript String Methods 2) slice(start, end): extracts a part of a string and returns the extracted part in a new string. • This example slices out a portion of a string from position 7 to position 12 (13-1) and the output will be “Banana”.
  • 5. JavaScript String Methods 3) substring(start, end): is similar to slice() and the difference is that substring() cannot accept negative indexes. • This example substring a portion of a string from position 7 to position 12 (13-1) and the output will be “Banana”.
  • 6. JavaScript String Methods 4) substr(start, length): is similar to slice() and the difference is that the second parameter specifies the length of the extracted part. • This example will print from position 7 to and count 6 characters after it and the output will be “Banana”.
  • 7. JavaScript String Methods • Replacing String content: 5) replace() method : replaces a specified value with another value in a string. • This example will replace “Microsoft” with “W3schools”
  • 8. JavaScript String Methods • To convert string to UpperCase(): 6) toUpperCase() method: will be used to convert string from lower to upper case.
  • 9. JavaScript String Methods • To convert string to lower case(): 7) toLowerCase() method: will be used to convert string from Upper to lower case.
  • 10. JavaScript String Methods 8) concat() method : joins two or more strings
  • 11. JavaScript String Methods 9) trim() method : used to remove white spaces from both sides of a string.
  • 12. JavaScript String Methods 10) indexof() method : return index of (position) of the first occurrence of specified text in string. •The result of this code will be 7.
  • 13. JavaScript String Methods 11) lastindexof() method : return index of (position) of the last occurrence of specified text in string. • The result of this code will be 21.