Question: Make a function for result using JAVASCRIPT This method accepts a single string argument called path which describes a path to the object. This path
Make a function for result using JAVASCRIPT
This method accepts a single string argument called path which describes a path to the object. This path is structured in the following manner a[0].b.c which means it should retrieve the first element of the list called a and for that item retrieve the property b and for that property retrieve the property c. If there it is a valid path it should return the value of the last property of the path otherwise return undefined

const obj = { 'a': [{ 'b': { 'c1': 10 } }] }; console.log(obj6.result('a[@].b.c1')); // 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
