Created
January 17, 2017 08:50
-
-
Save SterlingAr/8c9f19de0e6d8838d8d9e8d93c3bd948 to your computer and use it in GitHub Desktop.
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
var newString; | |
if(str.length > num){ | |
newString = str.slice(0,num-3) + "..."; | |
return newString; | |
}else if(str.length === num || num > str.length){ | |
return str; | |
}else if( num <= 3){ | |
newString = str.slice(0,num-3) + "..."; | |
return newString; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment