refactor de javascript