"char" is a reserved word in JavaScript

http://www.crockford.com/javascript/survey.html
Changing variable from "char" to "ch".