How to Determine When a Sticky Element is Stuck in JavaScript

A small JavaScript function for the pseudo-class CSS never gave us.