/*
For browsers that do not support the trim() method,
you can remove whitespaces from both sides of a string with a regular expression:
*/functionmyTrim(x) {
return x.replace(/^\s+|\s+$/gm,'');
}
functionmyFunction() {
var str = myTrim(" Hello World! ");
alert(str);
}