mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
12 lines
322 B
Markdown
12 lines
322 B
Markdown
|
```
|
||
|
let str = ` hello world ! `;
|
||
|
let _trim = function () {
|
||
|
if (typeof this == "number") new Error("Invalid or unexpected token");
|
||
|
if (typeof this !== "string")
|
||
|
new Error("Cannot read property 'trim' of" + this);
|
||
|
let reg = /^\s*|\s*$/g;
|
||
|
return this.replace(reg, "");
|
||
|
};
|
||
|
|
||
|
String.prototype._trim = _trim;
|
||
|
```
|