Two parameters, the first required, the second optional. In our example above, from indicates the index where to start the extraction – remember, the first character is at index 0. The second, optional parameter is to, which if specified indicates the index where to stop the extraction. If omitted, substring extracts the rest of the string.
var str="Hello world!"; document.write(str.substring(3)+"
The above will output:
lo world! lo w