//No generic function to do that at all.
//use Lodash, famous for such must have functions, all efficiently built
//http://lodash.com/docs#isEqual ---
npm install lodash
_.isEqual(object, other);
const isEqual = (...objects) =>
objects.every((obj) => JSON.stringify(obj) === JSON.stringify(objects[0]));
if (!isEqual(this.lastValue, val)) {
JSON.stringify(obj1) === JSON.stringify(obj2)
//turn them into text then compare their values
JSON.stringify(obj1) === JSON.stringify(obj2)
/*not the best solution but work for simple objects without methods
Happy Coding */ (●'◡'●)