Find the largest prime factor with Javascript
问题 Thanks for reading. Pretty new to Javascript and programming in general. I'm looking for a way to return the largest prime factor of a given number. My first instinct was to work with a while loop that counts up and finds prime factors of the number, storing the factors in an array and resetting each time it finds one. This way the last item in the array should be the largest prime factor. var primerizer = function(input){ var factors = []; var numStorage = input for (x=2; numStorage != 1; x+