javascript function udpate