我有两个地址对象,每个对象中有3个值。 如何在两个对象中测试它的值是否相等?
JSON:
{{1}}
答案 0 :(得分:0)
var address1 = {"address1": { "city": "bng", "street": "dng", "zipcode": "23421" }};
var address2 = {"address2": { "city": "chn", "street": "as", "zipcode": "5645" }};
var equality = JSON.stringify(address1.address1) != JSON.stringify(address2.address2) ? 'not same' : ' same';
console.log(equality);
var address1 = {"address1": { "city": "bng", "street": "dng", "zipcode": "23421" }};
var address2 = {"address2": { "city": "bng", "street": "dng", "zipcode": "23421" }};
var equality = JSON.stringify(address1.address1) != JSON.stringify(address2.address2) ? 'not same' : ' same';
console.log(equality);