Get value from array by key - Node.js Array

Node.js examples for Array:Array Value

Description

Get value from array by key

Demo Code


Array.prototype.forKey = function(key,label){
    return this.filter(function(item){
        return item[key] === label;
    })[0]/*from ww  w .ja v a2  s.c o  m*/
}

Related Tutorials