JSFiddle - React, Tailwind, and code Playground

by Eugen Sunic

JavaScript

Array.prototypep = function(callback) {
  const result = [];
  for (let i = 0; i < this.length; i++) {
    const value = this[i];
    if (callback(value)) {
      result.push(value)
    }
  }
  return result;
}


const a = [1, 2, 3, 4, -1, 3, -2].filter1((x) => x < 0);
const b = [1, 2, 3, 4, -1, 3, -2].filter((x) => x < 0);
console.log()