function wordCount( val ){
var wom = val.match(/S+/g);
return {
charactersNoSpaces : val.replace(/s+/g, '').length,
characters : val.length,
words : wom ? wom.length : 0,
lines : val.split(/r*n/).length
};
}
I am just asking, they both behaving totally opposite.