updates js to clear command when hit end of list