How about nested if?
$scope.addToCart = function () {
if (flagA) {
if (flagB) {
if (flagC) {
alert('nononono!');
return;
}
}
}
someAnotherFunction();
};
I have a function:
$scope.addToCart = function () {
var foo = 5;
if (someFlag == 'Y') {
alert('warning!');
return;
}
someAnotherFunction();
};
I invoke this function somewhere
ng-click = "addToCart()"
My intention is to exit this function if
someFlag == 'Y'
then not to execute
someAnotherFunction();
But it still execute it.
WebStorm tell me this return
is unnecessary so it could be safely removed.