Skip to content

Instantly share code, notes, and snippets.

@jsstoni
Created December 13, 2016 19:33
Show Gist options
  • Save jsstoni/0d3db9c0a84710e87c1fe84080adf9e4 to your computer and use it in GitHub Desktop.
Save jsstoni/0d3db9c0a84710e87c1fe84080adf9e4 to your computer and use it in GitHub Desktop.
Acortar texto de un párrafo por lineas javascript
var stringCut = function (str, limit) {
//str = string texto para acortar
//limit = limite de lineas para mostrar
limit = limit || 10;
var separe = str.split(/\n/g);
return separe.slice(0, limit).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment