brainfuck
brainfuck copied to clipboard
Remove array prototype
You have created an array prototype method top
. There is little point to this method.
if (!Array.prototype.top) {
Array.prototype.top = function top() {
return this[this.length - 1];
};
}
You really do not need to make an array prototype to simply return the last element of an array. By doing this, you break features such as for...in
.
There is debate as to whether this is bad practice or not, and I honestly don't care what you do in your own personal workspaces. However, as a public library you are unwittingly breaking other people's projects. Imagine, if you will, somebody adding this as a dependency to their large project. Suddenly, because of the array prototype, it ceases to function. Is saving 26 characters really worth this?