相关疑难解决方法(0)

Change Array.prototype in node.js

I want to make some functions available to all my arrays.

For instance, I want a function to remove duplicates:

Array.prototype.uniq = function () {
  return Array.from(new Set(this));
};
Run Code Online (Sandbox Code Playgroud)

But I want to make this function work in my entire node.js project.

Will it work if I just put it in server.js which is run when I type npm start?

It would be great if it also works on the client. Is it possible or should I consider server …

javascript arrays prototypejs node.js

0
推荐指数
1
解决办法
2038
查看次数

标签 统计

arrays ×1

javascript ×1

node.js ×1

prototypejs ×1