tk.stas,
Сообщение от tk.stas
|
С помощью .toUpperCase() ошибку выдает,
|
<script>
var people = [
{ "name": "bob", "dinner": "pizza" },
{ "name": "john", "dinner": "sushi" },
{ "name": "john", "dinner": "hummus" }
];
var str = "john"
var obj = people.filter(function (person) { return person.name.toUpperCase() == str.toUpperCase() });
document.write(JSON.stringify(obj, null, 4))
</script>