hmkcode/jString.js

Function capitalize() has reference error in case of empty string.

Closed this issue · 0 comments

String.prototype.capitalize = function(){
if(this == '') return str;
else return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();
}

Return of str leads to a error. Str is not defined.