A javascript function to generate factors of a given integer.