15 lines
249 B
JavaScript
15 lines
249 B
JavaScript
|
|
||
|
function Trim(str)
|
||
|
{
|
||
|
var result;
|
||
|
if (typeof str === 'string')
|
||
|
{
|
||
|
result = str.replace(/^\s+|\s+$/g, '');
|
||
|
return result;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
console.log(Trim(' w3resource '));
|