How to dynamically create Twitter’s tweet button and Facebook’s like button!

There are many examples out there in the world of internet, which show how to integrate the tweet button and the like button, but none show how to do it dynamically. In this post I have tried to show how trivial it is to generate tweet and like button dynamically using JavaScript.