JavaScript: String Operators/Function/Methods

By Xah Lee. Date: .

String length

"abc".length; // 3

Note: no parenthesis after β€œlength”.

Substring

console.log( "01234".slice(1,3) === "12"); // true

Index starts at 0.

[see String.prototype.slice]

Join String

Use the plus sign + to join strings.

console.log( "tiger" + "rabbit"); // tigerrabbit

String Methods

JavaScript String

BUY
Ξ£JS
JavaScript in Depth

JavaScript in Depth

Basic Syntax

Value Types

Variable

String

Property

Object and Inheritance

Array

Function

Constructor/Class

Iterable 🌟

Misc