Added fail-safes and html testing page

replaceChar() and replaceChars() will now ensure that the given indices
exist. Added index.html with a script include of extend.js for console
testing.