Question: I'm trying to access a property of an object using a dynamic name. Is this possible?

```
const something = { bar: "Foobar!" };
const foo = 'bar';
something.foo; // The idea is to access something.bar, getting "Foobar!"

```

Answer: 
There are [two ways to access properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors) of an object:

* Dot notation: `something.bar`
* Bracket notation: `something['bar']`

The value between the brackets can be any expression. Therefore, if the property name is stored in a variable, you have to use bracket notation:

```js
var something = {
  bar: 'foo'
};
var foo = 'bar';

// both x = something[foo] and something[foo] = x work as expected
console.log(something[foo]);
console.log(something.bar)
```
Finding Object by reference without, strings,
Note make sure the object you pass in is cloned , i use cloneDeep from lodash for that

if object looks like

```
const obj = {data: ['an Object',{person: {name: {first:'nick', last:'gray'} }]

```

path looks like

```
const objectPath = ['data',1,'person',name','last']

```

then call below method and it will return the sub object by path given

```
const child = findObjectByPath(obj, objectPath)
alert( child) // alerts "last"

const findObjectByPath = (objectIn: any, path: any[]) => {
    let obj = objectIn
    for (let i = 0; i <= path.length - 1; i++) {
        const item = path[i]
        // keep going up to the next parent
        obj = obj[item] // this is by reference
    }
    return obj
}

```