Okay, I don't even know how to phrase this question, let me begin with small set. Suppose, I have 3 input data fields:
let user= 'P' (Primary) or 'S' (secondary)
let key = k1 (random key)
let verification= passed or failed
Now the value of the key depends on the user
and verification
if(user=='P' && verification === 'passed)
return {k1:A}
if(user=='S' && verification === 'passed)
return {k1:S}
if(user=='P' && verification === 'failed)
return {k1:F}
Now, imagine possible number of values for user are 10, verification 3 and keys are 10. Then this code becomes ugly. Similarly, it would be if I choose Array. This would be simple if I have to write server-side app with DB. Then I could simply fire the query. What would you think the best way to solve this for browser JS app?
Again, just looking for ideas and not code. Thanks!