Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70919

Using if else inside for loop

$
0
0

@maxvortex wrote:

 for(var key in this.filteredusers){
      if(this.filteredusers[key].displayName == this.newuser.displayName){
        toaster.setMessage('Username '+this.newuser.displayName+ ' already exists');
        toaster.present();
        console.log('user exist'); //it works till here 
      }
      else{
        console.log('user does not exist'); //but it never displays this if above statement is wrong it 
      //simply doesn't display anything. some times it works. sometimes it does not work at all.
      }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>