jquery code works in Firefox and Chrome but not in IE11 [duplicate]

Array.from is not supported in Internet Explorer.

As you use jQuery, just call .each on the nodes collection:

nodes.each(function(_, n) {
  n.nodeValue = n.nodeValue.trim();
});