Nodejs Array Find findHighestNumber(inField)

Here you can find the source of findHighestNumber(inField)

Method Source Code

Array.prototype.findHighestNumber = function(inField)
{
   var tmp = [];/*from   w ww.  j  av a2s . c o m*/

   for (var i = 0; i < this.length; i++) {
      tmp[i] = Number(this[i][inField]);
   }

   if(this.length < 1)
      return 0;

   // (c) john resig: http://ejohn.org/blog/fast-javascript-maxmin/
   return Math.max.apply(Math, tmp);
}

Related

  1. findElement(search, func)
    Array.prototype.findElement = function(search, func) {
      for(var i = 0; i < this.length; i++) {
        if(func(search, this[i]))
           return this[i];
      return null;
    
  2. findElements(config)
    Array.prototype.findElements = Array.prototype.findElements || function (config) {
        var i,
        j,
            key,
            keys = [],
            isFound,
            el = null,
            results = [];
        for (key in config) {
    ...
    
  3. findFirst(fnCheckCallback, parameter)
    Array.prototype.findFirst = function(fnCheckCallback, parameter) {
      for (var elementIndex in this) {
        if (this.hasOwnProperty(elementIndex) && fnCheckCallback.apply(this[elementIndex], [elementIndex, parameter])) {
          return this[elementIndex]; 
    };
    
  4. findFirst(fun)
    Array.prototype.findFirst = function(fun) {
      for(var i = 0; i < this.length; i=i+1) {
        if(fun(this[i])) {
          return this[i];
    
  5. findFirst(test)
    Array.prototype.findFirst = function (test) {
        var i, item;
        for (i = 0; i < this.length; i++) {
      item = this[i];
      if (test(item)) {
          return item;
    };
    ...
    
  6. findIdx(fn)
    Array.prototype.findIdx = function(fn) {
        return this.indexOf(this.filter(val => fn(val))[0]);
    };
    
  7. findIfNotError(filter)
    Array.prototype.findIfNotError = function(filter) {
        var result = this.find(filter);
        if ( !result ) {
            throw new Error();
        return result;
    
  8. findInJson(attr, value)
    Array.prototype.findInJson = function (attr, value){
      for(var i=0; i<this.length; i++){
        this[i][attr] = this[i][attr].toLowerCase();
        if(this[i][attr] == value){
          return true;
        };
      };
      return false;
    };
    ...
    
  9. findMaximumfindIt()
    var array = [47, 98, 0, -23, 4, 87.3, 0.0003, +9];
    Array.prototype.findMaximum = function findIt() {
    var arrayValue = 0;
    for(var i = 0; i < array.length; i++) {
      if (array[i] > arrayValue) {
        arrayValue = array[i];
      return arrayValue;
    ...