stringName.substring(starting index, ending index)

substring() method allows you to extract a new string from an existing string starting at the specified index and continuing though (but not including) the ending index.

If you want to extract the first three characters from a string, the syntax is:
var stringName = "JavaScript is fun"

stringName.substring(0,3)

// result is characters 0 through 2, "Jav"
Remember - substring's second parameter is not included in the new string, just everything before that index.

View the Source