String (String - JavaScript)
Creates a new String object.
Defined in
String (Standard - JavaScript)Syntax
String()
String(str:string)
Parameters | Description |
---|---|
str |
The value of the String object. The value is empty if not specified. |
Examples
(1) This example returns (as a computed value, for example)Paris Moscow Tokyo
.new String("Paris Moscow Tokyo")
(2)
This example returns the same.
var cities = new String();
cities = "Paris Moscow Tokyo";
cities
(3) This example returns
PARIS MOSCOW
TOKYO
, showing that server-side string literals are treated
as String objects. This does not work client-side."Paris Moscow Tokyo".toUpper()