How to get the current URL in JavaScript

I want to do some operations on current URL in JavaScript. How to fetch the current URL?