JavaScript tutorial-String object


JavaScript String object

In this part, we will look at another useful JavaScript object called String. The String object provides a rich set of properties and methods to manipulate the string values. To create a String object you also need to use the new keyword.

Example: var Mystr=new String();

You can assign a value to the string object when the object is created, by supplying it in the brackets.

Example: var Mystr=new String("JavaScript is a must.");

Alternately, you can assign the value to the string object like this:

var Mystr=new String();

Mystr="JavaScript is a must.";

The subsequent parts of this JavaScript tutorial we will discuss about useful properties and methods such as length, chartAt, chartCodeAt, indexOf, lastIndexOf, match, replace, search, Split, subStr, subString, toLowerCase, toUpperCase,




Comments




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.