That modification is not recommended at all.
why?
When you modify a JS object prototype like Object and/or Array (in your case), you are adding a possibility of broke your code. Another library will add the same method(s) you add to the prototype but with another purpose so, your code is broken.
Object prototype modification is only being recommended to add functionality specified by the standard which is not yet supported, in other words, for adding polyfills.
You should modify your code:
class MyArray extends Array {
pushFn(nr) {
return [...this, nr, 1];
}
}
const test = new MyArray();
test[0] = 'test';
console.log(test.pushFn('one'));
Or you can create your library for that kind of modifications.