How can I set a thumbnail when sharing a page on facebook?

When I try to share a link using the javascript sdk, the thumbnail it takes is the first image that appears in the DOM of the page, so no matter what link I share the thumbnail is always the same, I would like to set a thumbnail depending on the link that is shared

Asked about 2 months ago