JavaScript String Object
Last Updated Jul 29, 2015, 07:00:14 PM
JavaScript String Object
JavaScript strings stores the simple characters as text
The JavaScript string
object is most commonly used in the JavaScript. JavaScript string object is used to store and manipulation with text. The String object makes your task easy to store a series of characters and wraps the string primitive data type with some helper methods.
The above example code will store the string called iPhone 5s
Try It Now
The JavaScript string
object is most commonly used in the JavaScript. JavaScript string object is used to store and manipulation with text.
Strings are useful for holding data that can be represented in text form.
The string parameter is series of characters that is properly encoded.
Declaration
JavaScript String Object Methods
Method | Description | Example |
---|---|---|
charAt() | charAt() method returns the character at the specified index. |
Try It Now |
charCodeAt(x) | charCodeAt(x) method returns the Unicode value of the character at position “x†within the string. |
Try It Now |
concat() | Combines the text of two strings and returns a new string. | Try It Now |
indexOf() | Returns the first occurance of a character in a string | Try It Now |
replace() | It will find a matched string and replace it with other string | Try It Now |
search() | search for a match between a regular expression and a specified string. | Try It Now |
Here is the list of all important JavaScript Native Objects −
JavaScript Number Object
JavaScript Boolean Object
Sources and Credits
The source of the content has been referred and updated with Mozilla Developer Network and W3C Organization
Last Updated Jul 29, 2015, 07:00:14 PM
Browser compatibility
Feature | |||||||
---|---|---|---|---|---|---|---|
String Object | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Complete Beginner to JavaScript Developer - Udemy
Advanced JavaScript Development - Udemy
Learn javascript in one month from experts -OneMonth
Become a Certified Web Developer - Udemy