I have a each loop inside a IF condition, inside this loop again I have IF ELSE condition, if IF condition inside this each loop matches I want my compiler to jump out of the outer IF condition inside which I have this each loop,
If I use return or return false it throws me outside of each loop, not outside the outer IF condition.
if (localStorage.getItem('Token')) {
$(".menu-highlight li a").each(function () {
var aTag= $(this).text();
if(route==aTag){
this.router.navigate([route]);
}
else{
return;
}
});
alert('User is already logged In');
}
I want compiler to jump out of this IF (if (localStorage.getItem('Token')) {}) condition