The factors variable has a memory persisting through different function calls. For example, when getPrimeFactors(4) is called, (for the test case [1, 5]) the factors[2] is incremented. It returns {‘2’: 2} instead of {‘2’: 1}.
What type of variable is factors? It is able to remember the previous getPrimeFactors(2) and return {‘2’: 2} for getPrimeFactors(4).
I would like to read the documentation and learn more, but I do not know what to look up.
its just an object, it will keep track of which number has previously showed up and increment it by 1, if not found in “factors” variable then it creates a new entry with that number with value of 1