The String
type is the object representation for strings
and is created using the String constructor:
String constructor |
Yes | Yes | Yes | Yes | Yes |
var stringObject = new String("hello world");
console.log(stringObject);
The code above generates the following result.
We can access an individual character with bracket notation and a numeric index:
var stringValue = "hello world";
console.log(stringValue[1]); //"e"
The code above generates the following result.