Javascript String Prototype Slice from left and right
String.prototype.left = function(count) { return this.slice(0, count); } String.prototype.right = function(count) { return this.slice(-count); } let myString = "The quick brown fox."; console.log( myString.left(10));//from w w w . jav a 2s . com console.log( myString.right(10) );