js how to reduce size of string code example
Example 1: javascript set max length of string
String.prototype.trimEllip = function (length) {
return this.length > length ? this.substring(0, length) + "..." : this;
}
Example 2: How to get length of string in javascript without using native length method
var str = userInput[0];
var count = 0;
while(str[count] !== undefined)
{
count += 1;
}
console.log(count)