js中重写trim()函数
<script type=
"text/javascript"
>
String.prototype.trim =
function
()
{
return
this
.replace(/(^\s*)|(\s*$)/g,
""
);
}
</script>
时间: 2025-01-17 16:43:52
js中重写trim()函数
<script type=
"text/javascript"
>
String.prototype.trim =
function
()
{
return
this
.replace(/(^\s*)|(\s*$)/g,
""
);
}
</script>