The following example demonstrates how the sub method works:
<HEAD> <SCRIPT LANGUAGE="JavaScript"> function subTag() { var strVariable = "This is a string object" strVariable = strVariable.sub( ); return strVariable ; } </SCRIPT></HEAD> <BODY> <P> See how it work in Html <SCRIPT LANGUAGE="JavaScript"> document.write(subTag());</SCRIPT></P> </BODY>
|
To run the code, paste it into JavaScript Editor, save as htm format file and click the Show Internal View button.