This isn't specific to Javascript, but rather how IEEE Floating Point Numbers are represented internally that cause precision errors.
I won't reproduce the content here, but there are a bunch of resources available to help explain what is going on in your example.
Here is one: http://www.petebecker.com/js/js200006.html