only display a part of string js code example
Example 1: limit characters display javascript
var str = 'Some very long string';
if(str.length > 10) str = str.substring(0,10);
Example 2: javascript substring
// zero-based index, 'end' is excluded from result
myString.substring( start, end )