title: Change Array.prototype in node.js
body: <p>I want to make some functions available to all my arrays.</p>
  
  <p>For instance, I want a function to remove duplicates:</p>
  
  <pre><code>Array.prototype.uniq = function () {
    return Array.from(new Set(this));
  };
  </code></pre>
  
  <p>But I want to make this function work in my entire <code>node.js</code> project.</p>
  
  <p>Will it work if I just put it in <code>server.js</code> which is run when I type <code>npm start</code>?</p>
  
  <p>It would be great if it also works on the client. Is it possible or should I consider server and client strictly separated from one another?</p>
  
  <p>Is it bad practice to extend <code>Array.prototype</code> like this? I just think it seems stupid to write the code many times.</p>
  
  <p>Another options could be to use</p>
  
  <pre><code>function uniquify(arr) {
    return Array.from(new Set(arr));
  }
  </code></pre>
  
  <p>but <code>array.uniq()</code> seems better than <code>uniquify(array)</code>.</p>