String
Strings are sets of characters between quotes. See Chapter 11 for more information on strings.
Properties
| 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
| 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.
| FF, IE 3 | Puts the string between |
For example:
var the_string = "something really important"; window.document.writeln(the_string.big()); ...
Get The Book of JavaScript, 2nd 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.