Last active
August 29, 2024 15:21
-
-
Save JuniorTak/f1e2c4342f3e9001ace8304ba03eae09 to your computer and use it in GitHub Desktop.
Excerpt with JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// excerpt will be the shortened text of content, position being the start index of string method lastIndexOf. | |
excerpt = content.substr( 0, content.lastIndexOf( ' ', position ) ) + '...'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment