25.31. The String Object

String is an important datatype in JavaScript. It does not correspond directly to any particular HTML elements but is widely used.

Constructor

new String(value) This constructor builds a new String.

Properties

length This read-only property gives the number of characters in the string.

Methods

anchor(name) This method returns a copy of the current string, embedded between <A NAME="name"> and </A>. For example,

"Chapter One".anchor("Ch1")

evaluates to

'<A NAME="Ch1">Chapter One</A>'

big() This method returns a copy of the string, embedded between <BIG> and </BIG>.

blink() This method returns a copy of the string, embedded between <BLINK> and </BLINK>.

bold() This method returns a copy of the string, embedded between <B> ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.