left (JavaScript)

Gets a substring starting at the left.

Defined in

String (Standard - JavaScript)

Syntax

left(count:int) : string
Parameters Description
count The number of characters to get.
Return value Description
string The substring.

Usage

This method gets the number of characters specified by the parameter starting at index 0.

Examples

The following example returns Paris.
var cities = new String("Paris   Moscow   Tokyo   Paris");
cities.left(5)