string

Strings are immutable sequences of characters used to store text.


Creating strings

// Examples:
var s = "hello";
var empty = "";

Properties

Property Description Example
.length Returns the number of elements "abc".length → 3

Methods

Method Description Example
split(delim) Splits a string with a delimiter "a,b,c".split(",")["a", "b", "c"]

Indexing

var s = "hello";
var first = s[0]; // 'h'

Comparison

"abc" == "abc"   // true
"abc" != "def"   // true