code: function(test, fromEnd) {
        var i;
        if (typeof test !== 'function') return undefined;
        if (fromEnd) {
          i = this.length;
          while (i--) {
            if (test(this[i], i, this)) {
              return this[i];
            }
          }
        } else {
          i = 0;
          while (i < this.length) {
            if (test(this[i], i, this)) {
              return this[i];
            }
            i++;
          }
        }
        return null;
      }
docs: traverses array and returns first element on which test function returns true
  @param {Function<Boolean>} test
  @param {Boolean} fromEnd pass true if you want to traverse array from end to beginning
  @returns {*|null|undefined} an element of an array, or undefined when passed param is not a function