Here you can find the source of toUpper()
String.prototype.toUpper = function() { var pattern = /[a-z]/g; return this.replace(pattern, function(args) { return String.fromCharCode(args.charCodeAt() - 32); });//from ww w . j av a 2s. c om };
String.prototype.toUpper = function(){ result = this.replace(/[a-z]/g, function(x){ return x.toUpperCase(); }); return result; };
String.prototype.toUpper = function() { return this.replace(/([a-z])/g, function(match){ return String.fromCharCode(match.charCodeAt(0) - 32); }); };
String.prototype.toUpper = function() { return this.replace(/[a-z]/g, function(x) { return String.fromCharCode(x.charCodeAt(0) - 32); });
String.prototype.toUpperCase = function() { var s = ""; for (var i = 0, len = this.length; i < len; i++) { var char = this.charCodeAt(i); if (char >= 97 && char <= 122) { s += String.fromCharCode(char - 32); } else { s += this[i]; return s; };