Prime Factors in JS