js functions complete