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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.