Array.prototype.containsByKey(key, value)

Description:

Created a cloned object by itself.

Parameters:

  • key
    • Type: string
  • value
    • Type: string/number/boolean

Returned Value:

  • Return a boolean value indicating whether the array contains item which meet the criteria for the specified key-value.

Sample:

var array = [{name: "Apple", weight: 200}, {name: "banana", weight: 50}, {name: "Lemon", weight: 180}];
document.write(array.containsByKey("name", "banana"));
//Result: true

Last edited Aug 22, 2012 at 8:45 AM by rynnwang, version 2

Comments

No comments yet.