What is a reducer in JavaScript?