complete the js code.