refatorando user javascript