[coordinate.js] Added documentation

Added documentation and improved code readability along with some cleaning.

Change-Id: If23ce2326017840cdffcab8b173e455d37a48b90