People on Reddit often comment "I lost it" while quoting the funniest part of a joke to highlight how funny that part is. As I don't speak English much, I am not sure if this is Reddit-specific, but I guess not.
Where does this come from? Is it related that laughing from a joke is similar to "losing your mind"? That seems far-fetched. "I lost it" would intuitively mean "the joke stops making sense here" (i.e. "I lost track of the joke here"), which is the exact opposite of what it actually means.
What is the etymology of this phrase?