Sharing data from API to Social media ( twitter and facebook )

PHOTO EMBED

Sat Nov 07 2020 20:07:02 GMT+0000 (Coordinated Universal Time)

Saved by @jpannu

function shareQuote(socialMedia){
    const quote = quoteElem.textContent;
    const author = authorElem.textContent;

   const tweetUrl = `http://${socialMedia}.com/intent/tweet?text=${quote}-${author}`;
 
   window.open(tweetUrl , '_blank');

}

facebookBtn.addEventListener('click', shareQuote.bind(this,"facebook"))
tweetBtn.addEventListener('click' ,  shareQuote.bind(this,"twitter") );
content_copyCOPY