How does jQuery/JavaScript get the coordinates of an element?

The requirement is that I need to get information about the position of a movable component on a page so that I can move the component to the last set position when I go back to the page, here is the exampleI need to get information about the position of the left and right eyes and mouth on this page

I tried using offerset() but it didn’t work, I also checked on the internet that I could probably use getBoundingClientRect() but I didn’t have a clue how to do it