0% found this document useful (0 votes)
16 views2 pages

pr5 Rohit

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

pr5 Rohit

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical No : 5

Name : Gaurav Mahajan


Roll No : 30
Input :-
<html>
<head>
<h1 style ="font-size:25px;color:blue;">String Methods</h1>
</head>
<body>
<script>
var str1 = "Ashish";
var str2 = "Patil";
var str3 = "Computer";
var str4 = "Engineering";

document.write("str1 = "+str1+"</br>");
document.write("str2 = "+str2+"</br>");
document.write("str3 = "+str3+"</br>");
document.write("str4 = "+str4+"</br>"+"</br>");
document.write("1) Concatination using (+) operator = "+(str1+str2)+"</br>");
document.write("2) CharAt Method ="+(str1.charAt(3))+"</br>");
document.write("3) IndexOf Method ="+str2.indexof("h")+"</br>");
document.write("4) lastindexof Method ="+str4.lastIndexOf("i")+"</br>");
document.write("5) Search Method ="+str4.search("Engineering")+"</br>");
document.write("6) split Method ="+str1.split("")+"</br>");
document.write("7) SubString Method ="+str2.substring(2,6)+"</br>");
document.write("8)SubStr Method ="+str2.substr(2,6)+"</br>");
</script>
</body>

<body>
<h1 style ="font-size:25px;color:blue;">Convert String to Numbers and Numbers to
Strings</h1>
<script>
var s1 = "6";
var s2 = "8.55";
var s3 = "JavaScript";
var i = 25;

document.write("Result 1 ="+parseInt(s1)+"</br>");
document.write("Result 1 ="+parseFloat(s2)+"</br>");
document.write("string ="+i.toString()+"</br>");
document.write("Result 1 ="+str1.toUpperCase()+"</br>");
document.write(" Result 2 ="+str1.toLowerCase()+"</br>");
</script>
</body>
</html>

Output :-

You might also like