A library is a reusable piece of code which you use as it comes. A library will usually focus on a single piece of functionality, which you access through an API. You call a library function, it executes some code and then control is returned to your code
.
For example jQuery
D3.js
Google Charts
A framework is a piece of code which dictates the architecture to your project. Once you choose a framework to work with, you have to follow the framework's code and design methodologies
.
For example AngularJS
ReactJS
Ember.js