I'm new in web development and I'm trying to insert the current URL into href for a Facebook share button using JS. I tried in the following way but as you can see it's not correct.
function getURL() {
return window.location.href;
}
<div class="fb-share-button"
data-href="https://www.facebook.com"
data-layout="button"
data-size="small">
<a target="_blank"
href="getURL()"
class="fb-xfbml-parse-ignore">
Share
</a>
</div>