Update objects javascript