Javascript String pluralize(val)
String.prototype.pluralize = function(val) { if (val == 1) {//from w w w .j ava 2s . c om return val + " " + this; } else if (val == 0 || val >= 2) { return val + " " + this + "s"; } }