isEqual (a, b) Booleanpublic
Compares two objects, returning true if they are equal.
Ember.isEqual('hello', 'hello'); // true
Ember.isEqual(1, 2); // false
isEqual is a more specific comparison than a triple equal comparison. It will call the isEqual instance method on the objects being compared, allowing finer control over when objects should be considered equal to each other.
let Person = Ember.Object.extend({
isEqual(other) { return this.ssn == other.ssn; }
});
let personA = Person.create({name: 'Muhammad Ali', ssn: '123-45-6789'});
let personB = Person.create({name: 'Cassius Clay', ssn: '123-45-6789'});
Ember.isEqual(personA, personB); // true
Due to the expense of array comparisons, collections will never be equal to each other even if each of their items are equal to each other.
Ember.isEqual([4, 2], [4, 2]); // false
Parameters:
-
a
Object - first object to compare
-
b
Object - second object to compare
Returns:
-
Boolean
Please login to continue.