refactor comment javascript