bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/JavaScript/Working with Data
JavaScript•Working with Data

JavaScript String Reference

Concept visual

JavaScript String Reference

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Complete String Reference

Revised July 2025

Name

Description at()

Returns an indexed character from a string charAt() Returns the character at a specified index (position) charCodeAt() Returns the Unicode of the character at a specified index codePointAt() Returns the Unicode value at an index (position) in a string concat()

Returns two or more joined strings constructor

Returns the string's constructor function endsWith()

Returns if a string ends with a specified value fromCharCode()

Returns Unicode values as characters includes()

Returns if a string contains a specified value indexOf() Returns the index (position) of the first occurrence of a value in a string isWellFormed() Returns true if a string is well formed lastIndexOf() Returns the index (position) of the last occurrence of a value in a string length

Returns the length of a string localeCompare()

Compares two strings in the current locale match() Searches a string for a value, or a regular expression, and returns the matches matchAll() Searches a string for a value, or a regular expression, and returns the matches padEnd()

Pads a string at the end padStart()

Pads a string from the start prototype

Allows you to add properties and methods to an object repeat() Returns a new string with a number of copies of a string replace() Searches a string for a pattern, and returns a string where the first match is replaced replaceAll() Searches a string for a pattern and returns a new string where all matches are replaced search() Searches a string for a value, or regular expression, and returns the index (position) of the match slice() Extracts a part of a string and returns a new string split() Splits a string into an array of substrings startsWith() Checks whether a string begins with specified characters substr() Deprecated. Use substring() or slice() instead. substring() Extracts characters from a string, between two specified indices (positions) toLocaleLowerCase() Returns a string converted to lowercase letters, using the host's locale toLocaleUpperCase() Returns a string converted to uppercase letters, using the host's locale toLowerCase() Returns a string converted to lowercase letters toString() Returns a string or a string object as a string toUpperCase() Returns a string converted to uppercase letters toWellFormed() Returns a string where "lone surrogates" are replaced with the Unicode replacement character trim()

Returns a string with removed whitespaces trimEnd()

Returns a string with removed whitespaces from the end trimStart() Returns a string with removed whitespaces from the start valueOf() Returns the primitive value of a string or a string object

Note

All string methods return a new value.

They do not change the original string.

String HTML Wrapper Methods

HTML wrapper methods return a string wrapped inside an HTML tag.

These are not standard methods, and may not work as expected. The HTML wrapper methods are deprecated in JavaScript. They are only standardized for compatibility purposes and are not recommended for new development. Modern web development practices advocate for using CSS for styling and DOM manipulation to create and modify HTML elements, providing greater control and flexibility.

Method

Description anchor()

Displays a string as an anchor big()

Displays a string using a big font blink()

Displays a blinking string bold()

Displays a string in bold fixed()

Formula

Displays a string using a fixed - pitch font fontcolor()

Displays a string using a specified color fontsize() Displays a string using a specified size italics()

Displays a string in italic link()

Displays a string as a hyperlink small()

Displays a string using a small font strike()

Displays a string with a strikethrough sub()

Displays a string as subscript text sup()

Displays a string as superscript text

Complete JavaScript Reference

For a complete reference to all JavaScript properties and methods, with full descriptions and many examples, go to: W3Schools' Full JavaScript Reference. The reference inludes all JavaScript updates from 1999 to 2025.

Previous

RegExp Meta Characters

Next

JavaScript Bitwise Operations