|
JavaScript substring() Method:
substring() method extracts the characters in a string between two specified indices.
syntax:
substring(start-index,stop-index)
Example :
<script type="text/javascript">
var sting="welcome to javascript";
document.write(str.substring(0,4))
</script>
The output of the code above will be:
welco |