Question is bit crazy. Is there any possibility to using variable name instead of another, clearly, consider the following code where I have to switch over to any variable name "people" or "student" accordingly
var people=[
{name:"akash",age:25},
{name:"abi",age:22}
];
var student =[
{name:"Sanjai",age:25},
{name:"Ravi",age:35},
{name:"Bopara",age:36}
];
var variables=["people","student"];
var result= _.find(variables[0], function(o) { return o.age < 35; });
console.log(result);
via anisha raj
No comments:
Post a Comment