O'Reilly logo

The Book of JavaScript, 2nd Edition by thau!

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

String

Strings are sets of characters between quotes. See Chapter 11 for more information on strings.

Properties

length

FF, IE 3

Read-only: Number of characters in a string

Example:

var the_string = "hello";
var the_length = the_string.length;

This code sets the_length to 5.

Methods

anchor()

FF, IE 3

Takes a name as a parameter and returns an anchor tag with the string as the text of the link

For example:

var the_string = "Information About Fish";
var the_anchor = the_string.anchor("fish_info");
window.document.writeln(the_anchor);

writes <a name = "fish_info">Information About Fish</a> to a web page.

big()

FF, IE 3

Puts the string between <big> and </big> tags

For example:

var the_string = "something really important"; window.document.writeln(the_string.big()); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required