your head is meant to fall into them like a box.... not wrap around it like a present, and in that understanding there is a solace in knowing that javascript is not "the way"
This is the way of beginners. The truth is, read the source code of these libraries. You'll realize a lot of stuff on SO is just copypasta work-arounds, while a more elegant, more efficient solution may exist that just wasn't documented well for your use case.