156
rated 0 times
[
159]
[
3]
/ answers: 1 / hits: 35846
/ 6 Years ago, sat, march 10, 2018, 12:00:00
I came across this JavaScript function:
function myTrim(x) {
return x.replace(/^s+|s+$/gm,'');
}
I know that this function(mytrim()
) replaces some characters in the string(x), but what does /^s+|s+$/gm
do in the replace method?
Where can I learn more about these things?
Note- This function returns the string with removed spaces at both sides.
More From » regex