With the updated structure with an object, you could use the given keys directly, without iterating. All you need is the right property accessor.
object.property // dot notation object['property'] // bracket notation
var scheduleFee = { poor: { level1: 25, level2: 25, level3: 25 }, good: { level1: 15, level2: 20, level3: 25 }, vgood: { level1: 10, level2: 15, level3: 20 } },
key = 'good',
level="level2"
console.log(scheduleFee[key][level]);
solved Search in Objects without loops