Web
Analytics
JavaScript String Methods Example | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<title></title>
</head>
<body>
<script>
var a = “Hello THIS is Yogesh this Sharma”;
document.write(“Index of Method “, a.indexOf(“this”)+”<br/>”);
//Print 6
document.write(“Index of Method with Position “, a.indexOf(“this”, 8) + “<br/>”);
//Print 21
//Last Index
document.write(“LastIndexOfof Method “, a.lastIndexOf(“this”) + “<br/>”);
//Search Method
document.write(“Search Method “, a.search(/this/i) + “<br/>”);
//Slice Method
document.write(“Slice Method “, a.slice(2, 8) + “<br/>”);
//Character AT
document.write(“Character AT Method “, a.charAt(8) + “<br/>”);
//Concat Method
document.write(“Concat Method “, a.concat(” This is Concated Text”) + “<br/>”);
//bOLD METHOD
document.write(“Bold Method “, a.bold() + “<br/>”);
//FontSize
document.write(“Font Styles”, a.fontsize(16) + ” Font Color ” + a.fontcolor(“Red”) + “Italic Font ” + a.italics());
//Link Method
document.write(“Link Method are ” + a.link(“http://www.ceg.rajasthan.gov.in”));
</script>
</body>
</html>
 Download Source Code