Have one JSON object and contains list of currency values. If all currencies are not same I need to do a validation like "data mismatched", all same currencies need to proceed the remaining validations(else part). I tried with below code but failing at comparison.

```
Ex: 

'[{"currency":"EUR"},{"currency":"EUR"},{"currency":"USD"}]';  // data mismatches

'[{"currency":"EUR"},{"currency":"EUR"},{"currency":"EUR"}]';  // data matches

'[{"currency":"USD"},{"currency":"INR"},{"currency":"EUR"}]';  // data mismatches

```

```js
$(document).ready(function(){
var text = '[{"currency":"EUR"},{"currency":"EUR"},{"currency":"USD"}]';
obj = JSON.parse(text);
for (var i = 0; i < obj.length; i++) {
    if (obj[0].currency != obj[i].currency) {
        alert("Data mismatched");
    } else {
        alert("Data matched");
    }
  }
});
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
```