[Javascript] The trim() function
The trim () function is native PHP (and other languages) and is used to remove the spaces at the beginning and end of the string. There is no such function in Javascript, but you can use the following code to get the same results:
Function trim (myString)
{
return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}