Nodejs Array Get Object getFrequency()

Here you can find the source of getFrequency()

Method Source Code

Array.prototype.getFrequency=function(){
    this.sort()// www  . j  av a 2  s  .  c o  m
    var count=0
    var max={
        val:0,
        num:0
    }
    for (var i =1;i<this.length;i++){
        if(this[i]===""){
            continue
        }
        if(this[i]===this[i-1]){
            count++
            if(max.num<count){
                max.num=count
                max.val=this[i]
            }
        }
        else{
            count=1
        }
    }
    return max.val+"???"+max.num+"?"
}

Related

  1. getById(id)
    Array.prototype.getById = function(id) {
        for(var i=0; i<this.length; i++) {
            if(this[i]._id == id) {
                return this[i];
    
  2. getByKey(aName)
    Array.prototype.getByKey = function(aName) {
        for(var i = this.length-1; i >= 0; i--)
            if(this[i].getKey() === aName)
                return this[i];
        return null;
    };
    
  3. getEach(code)
    Array.prototype.getEach = function(code){
        var rev = [];
        for(var i = 0 ; i < this.length ; i++){
            rev.push(this[i][code]);
        return rev;
    };
    
  4. getIndex(a)
    Array.prototype.getIndex=function(a){
      var index=-1;
      for(var i=0;i<this.length;i++){
        if(this[i]==a){
          index=i;
          break;
      return index;
    ...
    
  5. getIndexBy(name, value)
    'use strict';
    Array.prototype.getIndexBy = function (name, value) {
      for (var i = 0; i < this.length; i++) {
        if (this[i][name] === value) {
          return i;
    };
    
  6. getIndexBy(name, value)
    Array.prototype.getIndexBy = function(name, value) {
      for (var i = 0; i < this.length; i++) {
        if (this[i][name] == value) {
          return i;
      return -1;
    
  7. getIndexBy(name, value)
    angular
        .module('app', [
            'angular.filter',
            'ui.router',
            'ngAnimate',
            'ngMaterial',
            'user',
            'login',
            'register',
    ...