Expedia Group interview question

Write a function that can be used to generate factorials.