0

I have a query filter in my code, I want to pass these two queries as one like this:

 case1 
  con = {'eq':['case1':dosome]}
 case2
  con = {'eq':['case1':dosome]}

I need to bind these two at the end like this

{'eq':['case1':dosome],'eq':['case2':dosome]}

the key eq should remain same.

Pimgd
  • 5,983
  • 1
  • 30
  • 45
Mohamed Nizar
  • 780
  • 9
  • 30

4 Answers4

2

Why not use an object with two properties like

{ eq: { case1: dosome, case2: dosome } }
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392
1

Sounds like you want an array of objects:

var your_array = new Array();
var con1 = {'eq':{'case1':dosome}}
your_array.push(con1)
var con2 = {'eq':{'case2':dosome}}
your_array.push(con2)

You can then use the methods for accessing parts of the array -> http://www.w3schools.com/js/js_array_methods.asp

jeffery_the_wind
  • 17,048
  • 34
  • 98
  • 160
0

Use merge() function. Also this will give error: ['case1':dosome]. Try this

<script>
var obj1 = {'eq':{'case1':dosome}};
var obj2 = {'eq':{'case2':dosome}}
var merge = obj1.merge(obj2);
</script>

Hope this helps

Utkarsh Dixit
  • 4,267
  • 3
  • 15
  • 38
0

You can try this:

{ eq: [
  { condition: 'case1', action: doSome } , 
  { condition: 'case2', action : doSomeOther }
]}
Morteza Tourani
  • 3,506
  • 5
  • 41
  • 48