Welcome To JavaScript
This tutorial will take you step by step through the fundamentals of Javascript.
You will learn how to write
String Length
The length of a string (a string object) is found in the built in property length:<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var txt="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; document.getElementById("demo").innerHTML = txt.length; </script> </body> </html>
output=26
document.getElementById("demo").innerHTML = txt.length;
Finding a String in a String
The indexOf() method returns the position (a number) of the first occurrence of a specified text (string) in a string:<!DOCTYPE html> <html> <body> <p id="p1">Please locate where 'locate' occurs!.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var str = document.getElementById("p1").innerHTML; var pos = str.indexOf("locate"); document.getElementById("demo").innerHTML = pos; } </script> </body> </html>
output=10
NOTE:
Did you notice that the indexOf() method and the search() method returned the same value?
The two methods look similar, but the search() method can take much more powerful search values.
You will learn about that in the chapter about regular expressions.
www.jsfiddle.net
I want to learn jQuery and Ajax for my upcoming project ILLY – Papercuts - Vera Blue
ReplyDeleteSerato DJ Keygen
ReplyDeleteget here the free application to activation the Serato DJ free Appplication.
Winthruster Keygen
The PC optimization is big task but when you decrease the program load time it is not a performance issue. There are many other options to clean the PC from online and offline threats. It has a strong thinking, finding and problem cleaning capability to remove the issue that fluctuates in computer