javascript - Search in Objects without loops -


i working optimization , performance problem objects like:

   var schedulefee = {                 poor = {level1:25,level2:25,level3:25} ,                 = {level1:15,level2:20,level3:25} ,                 vgood = {level1:10,level2:15,level3:20}             {; 

now want find good in schedule fee main concern performance , optimization appreciated.

with updated structure object, use given keys directly, without iterating. need 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]);


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -