Object.prototype.equalsByKey(obj, key)

Description:

Compare with a object and indicate whether they are the same.

Parameters:

  • obj: the object to be compared.
    • Type: Object
  • key: the key of object whose value is as the identity for the comparison.
    • Type: string

Returned Value:

  • Boolean value indicating whether they are the same.

Sample:

var obj = { name: "Banana", weight: 50 };
document.write(obj.equalsByKey({ name: "Banana", weight: 55 }, "name"));
//Result: true;

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

Comments

No comments yet.