Understanding jq's reduce function
It took me a bit of time to get my head around jq's reduce function. In this post I show how it relates to the equivalent function in JavaScript, which helped me understand it better, and might help you too.
Source: Understanding jq's reduce function, an article by DJ Adams.