Quality of a backlink is determined by numerous metrics:
Do follow vs no-follow
Domain authority
Nature of the link (external or internal)
Spam signals
User engagement
Anchor text
Relevancy
Position of the link on the page
JavaScript vs HTML