Question: So, im new to coding and trying to get into c++. I was trying to get through the second problem on Project Euler and thought i had a good grasp on how to approach it. Hours later, i gave up and decided to look it up. 

```
int x = 0;
int y = 1;
int z = x + y;
int sumeven = 0;
while (z < 4000000)
{
    x = y;
    y = z;
    z = x + y;
    if (z % 2 == 0)
    {
        sumeven += z;
    }
}
cout << sumeven;

```

thr problem im having is with the 

```
x=y; y=z; z=x+y;

```

everything else i understand. 

can someone explain this to me please. Im not sure how i would have known to do this without looking it up.

Answer: 
If we assume that all properties are strings, then you might do in the following way

```
const people = [
  // ...
]

const searchString = 'Bob'

const filterBy = (term) => {
  const termLowerCase = term.toLowerCase()
  return (person) =>
    Object.keys(person)
      .some(prop => person[prop].toLowerCase().indexOf(termLowerCase) !== -1)
}

const found = people.filter(filterBy(searchString))

console.log(found)

```

Update: alternative solution with RegExp and more old-school :) but 2x faster

```
const people = [
  // ...
]

const searchString = 'Bob'

const escapeRegExp = (str) => // or better use 'escape-string-regexp' package
  str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")

const filterBy = (term) => {
  const re = new RegExp(escapeRegExp(term), 'i')
  return person => {
    for (let prop in person) {
      if (!person.hasOwnProperty(prop)) {
        continue;
      }
      if (re.test(person[prop])) {
        return true;
      }
    }
    return false;        
  }
}

const found = people.filter(filterBy(searchString))

```
If the entire matched object is expected result you can use `for..of` loop, `Object.values()`, `Array.prototype.find()`

```
consy searchString = "Bob";
const re = new RegExp(searchString, "i");
let res = [];
for (const props of Object.values(people))
  Object.values(props).find(prop => re.test(prop)) && res.push(props);

```