mercredi 20 septembre 2017

How to javascript if(variable condition [object String])

//i want condition using Object String.(Sorry, English little)

'EX)'

var equalInfo1 = [];
var equalInfo2 = [];
var differInfo1 = [];
var differInfo2 = [];

for(var i=0: i < info1.length; i++{
 for(var j=0; j< info2.length; j++{

   if(condition){ 
  //  condition =>
  // (info1[i].orderNum == info1[j].orderNum) && (info1[i].state == 
  //  info1[j].state)

     equalInfo1.push(info1[i]);
     equalInfo2.push(info2[j]
   }else{
      differInfo1.push[info1[i];
      equalInfo2.push(info2[j];
   }
 }
}

equalInfo1 => [{orderNum : 1 ...}, {orderNum : 2 ...}]
equalInfo2 => [{orderNum : 1 ...}, {orderNum : 2 ...}]
differInfo1 => [{orderNum : 3 ...}]
differInfo2 => [{orderNum : 4 ...}]

//`i want condition using Object String.(Sorry, English little)`

//but, now logic ==> [variable condition = object String.....] = [Incorrect results] //but, now logic ==> [variable condition = object String.....] = [Incorrect results]

i want

if(variable condition) {

}else{

}

//but, now logic ==> [variable condition = object String.....] = [Incorrect results]

//Thank you.`

Aucun commentaire:

Enregistrer un commentaire