SP .trim () and jQuery.trim () fight

I am using a jQuery plugin datatable to create my own views of information retrieved from a list. These work mostly. Datatables is based on jQuery and is based on many features.

However, a few different options or calls to data types raise an error in the console:

Unrecognized TypeError: this.replace is not a function ... (init.js)

I put it back on jQuery and SharePoint, both of which are trying to use polyfill String.trim (),

The jQuery version $ .trim (value) returns a string with the spaces at the beginning and at the end. If you pass a number, only the number is returned.

The SP version of is in init.js and that's it

String.prototype.trim = function () {
return.replace (/ ^  s  s * /, "") .replace (/  s  s * $ /, ""))
}

The problem is that the jQuery implementation does not expect this String.prototype.trim () has been changed and so on $ .trim (number) will convert to number.replace (regex) and there is no substitute method for numbers.

The init.js file is loaded before jQuery, and I really do not want to completely revise jQuery.

Is there anyway to prevent SharePoint from confusing $ .trim ()?