4.7 BASIC STRING OPERATIONS

Strings are sequences of zero or more Unicode characters. String literals are enclosed within single or double quotes. Since CSJS involves working with HTML, a set of single quoted string literals can be embedded within a set of double quoted HTML or vice versa. For example,

<a href=“#” onClick=“alert(‘continue’)”> Click </a>

Strings are immutable in the sense that their values cannot be modified at a specific location. There is a charAt() method but nothing for setting a character at a specific location.

One of the most often used features pertaining to Strings is the concat operator. The ‘+’ operator is used for this purpose, overloaded with the (same) arithmetic operator.

Some of the basic string operations are ...

Get Web Technology: Theory and Practice 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.