Page 430 - Webapplication11_C11_Flipbook
P. 430
29. Assume a string “hi how are you”. Write JavaScript code to display
a. The length of the string
b. All characters between positions 5 and 12. (Both inclusive)
Ans. <html>
<body text="blue">
<script>
var str1="hi how are you";
document.write("Length of string: "+str1.length);
document.write("<br>Characters 5-12 are: "+str1.substring(5,13));
</script></body>
</html>
On running the above program, we get the following output:
428 Touchpad Web Applications-XI

