DEV Community

Discussion on: Simplest way to compare two numbers array in JS

Collapse
 
hnicolas profile image
Nicolas Hervé
Array.prototype.toString = () => "oups";
compareArr([1, 2, 3], [4, 5, 6]);
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
ksengine profile image
Kavindu Santhusa

Changing built-in Objects is a bad idea.

Thread Thread
 
hnicolas profile image
Nicolas Hervé

It is a bad practice, but in the browser context you should be aware that object prototype pollution exists.