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

JS Sop2 Writeup-1

The document provides an overview of the JavaScript String object, which allows manipulation of character series and includes various helper methods. It outlines the syntax for creating a String object and lists its properties, such as 'length', and methods like 'charAt()', 'substr()', 'substring()', and 'toString()'. The String object automatically converts between string primitives and String objects, enabling the use of these methods seamlessly.

Uploaded by

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

JS Sop2 Writeup-1

The document provides an overview of the JavaScript String object, which allows manipulation of character series and includes various helper methods. It outlines the syntax for creating a String object and lists its properties, such as 'length', and methods like 'charAt()', 'substr()', 'substring()', and 'toString()'. The String object automatically converts between string primitives and String objects, enabling the use of these methods seamlessly.

Uploaded by

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

JavaScript - The Strings Object

The String object lets you work with a series of characters; it wraps
Javascript's string primitive data type with a number of helper
methods.

As JavaScript automatically converts between string primitives and


String objects, you can call any of the helper methods of the String
object on a string primitive.

Syntax

Use the following syntax to create a String object −

var val = new String(string);

The String parameter is a series of characters that has been


properly encoded.

String Properties
Here is a list of the properties of String object and their description.

Sr.No. Property & Description

length
1
Returns the length of the string.

String Methods
Here is a list of the methods available in String object along with
their description.

Sr.N
Method & Description
o.

charAt()
1
Returns the character at the specified index.
substr() Returns the characters in a string beginning at the specified
2
location through the specified number of characters.

substring()
3 Returns the characters in a string between two indexes into the string.

4 toString() Returns a string representing the specified object.

You might also like