How can I, using Javascript, make a
function that will trim string passed as argument, to a specified length, also passed as
argument. For
example:
var string =
"this is a string";
var length = 6;
var trimmedString =
trimFunction(length, string);
// trimmedString should
be:
// "this
is"
Anyone got ideas?
I've heard something about using substring, but didn't quite
understand.
No comments:
Post a Comment