update javascript add method