Working with string class properties:
A string is a sequence of characters. In JavaScript, all the strings are represented as an instance of string class. The purpose of string object is to perform all the operations on the stored text, such as finding the length of text. The string object is a wrapper class and a member of the global objects.
Properties of the String object:
S.No. |
Property |
Property |
1. |
constructor
|
Returns the function, which creates the prototype of the String object.
|
2. |
Length
|
Returns the length of the string.
|
3. |
Prototype
|
Adds properties and methods to an object.
|
Demo:
- Create the following document called StringProperties.html.
- Write the following code:
- Execute the script by Opening the file in the Web Browser. If you are using Internet Explore click on “Allow Blocked Content” to allow the script to execute and you are using Mozilla Firefox then click on allow “ActiveX Controls”.
Thanks for reading this blog.