Move cursor to end of field using javascript

In a web form I use the javascript “focus()” method to move the cursor to a text field. Is there a way to move the cursor to the end of the field? I want the user to be able to type more text in the field without first moving the cursor.