Dry Principle In Javascript