Javascript String Objects - Properties and Methods
Description
JavaScript string object refers to a string.
Can be created by the string constructor.
Javascript String Objects Property
Name | Description | Version |
---|---|---|
constructor | Specifies the function that creates an object's prototype. | Implemented in JavaScript 1.0 |
length | Use to get the length of a string object. | Implemented in JavaScript 1.0 |
prototype |
Use to add new properties and methods to an object. | Implemented in JavaScript 1.0 |
Javascript String Objects Methods
Name | Description | Version |
---|---|---|
anchor | Use to create an HTML anchor that is used as a hypertext target. | Implemented in JavaScript 1.0 |
big | Use to display a string in a big font as if it were in <big> tag. | Implemented in JavaScript 1.0 |
blink | Use to blink a string. | Implemented in JavaScript 1.0 |
bold | Use to display a string bold. | Implemented in JavaScript 1.0 |
charAt | Returns the specified character from a string. | Implemented in JavaScript 1.0 |
charCodeAt | Returns a number indicating the Unicode value of the character at the given index. | Implemented in JavaScript 1.0 |
concat | Use to join the text of two or more strings. | Implemented in JavaScript 1.0 |
fixed | Use to display a string in fixed-pitch font. | Implemented in JavaScript 1.0 |
fontcolor | Use to display a string in a specified color | Implemented in JavaScript 1.0 |
fontsize | Use to display a string in the specified font size | Implemented in JavaScript 1.0 |
fromCharCode | Returns a string created by using the specified sequence of Unicode values. | Implemented in JavaScript 1.0 |
indexOf | Returns the index within the calling string object of the first occurrence of the specified value | Implemented in JavaScript 1.0 |
italics | Use to display a string as italics | Implemented in JavaScript 1.0 |
lastIndexOf | Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. | Implemented in JavaScript 1.0 |
link | Creates an html hypertext link that requests another url. | Implemented in JavaScript 1.0 |
match | Use to match a regular expression against a string. | Implemented in JavaScript 1.0 |
replace | Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring. | Implemented in JavaScript 1.0 |
search | Use to search for a match between a regular expression and a specified string. | Implemented in JavaScript 1.0 |
slice | Use to extract a section of a string and returns a new string. | Implemented in JavaScript 1.0 |
small | Display a string in a small font. | Implemented in JavaScript 1.0 |
split | Use to split a string object into an array of string. | Implemented in JavaScript 1.0 |
strike | Display a string as struck-out text | Implemented in JavaScript 1.0 |
sub | Causes a string to be displayed as a subscript, as if it were in a SUB tag. | Implemented in JavaScript 1.0 |
substr | Returns the characters in a string beginning at the specified location through the specified number of characters. | Implemented in JavaScript 1.0 |
substring | Returns the characters in a string between two specified position into a string. | Implemented in JavaScript 1.0 |
sup | Display a string as a superscript | Implemented in JavaScript 1.0 |
toLowerCase | Use to converts a string to lowercase. | Implemented in JavaScript 1.0 |
toSource | Use to get the source code of the object. | Implemented in JavaScript 1.0 |
toString | Use to get a string representing the specified object. | Implemented in JavaScript 1.0 |
toUpperCase | Use to convert a string to uppercase. | Implemented in JavaScript 1.0 |
valueOf | Returns the value of a string object. | Implemented in JavaScript 1.0 |
See also:
JavaScript Core objects, methods, properties.
Previous: JavaScript toString() Method: RegExp Object
Next:
JavaScript constructor Property: String Object
Test your Programming skills with w3resource's quiz.
JavaScript: Tips of the Day
How to insert an item into an array at a specific index (JavaScript)?
What you want is the splice function on the native array object.
arr.splice(index, 0, item); will insert item into arr at the specified index (deleting 0 items first, that is, it's just an insert). In this example we will create an array and add an element to it into index 2:
var arr = []; arr[0] = "Jani"; arr[1] = "Hege"; arr[2] = "Stale"; arr[3] = "Kai Jim"; arr[4] = "Borge"; console.log(arr.join()); arr.splice(2, 0, "Lene"); console.log(arr.join());
Ref: https://bit.ly/2BXbp04
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework