Skip to content

Commit dee0191

Browse files
author
Christian Bender
committedApr 8, 2018
removed a comment and moved some code.
1 parent 7309191 commit dee0191

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed
 

‎src/js/others/balanced-symbols.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ export function parenthesesChecker(symbols) {
1717
} else if (stack.isEmpty()) {
1818
balanced = false;
1919
} else {
20-
// makes sure the stack isn't empty.
2120
if (!stack.isEmpty()) {
2221
top = stack.pop();
22+
if (!(opens.indexOf(top) === closers.indexOf(symbol))) {
23+
balanced = false;
24+
}
2325
} else { // error case
2426
balanced = false;
2527
}
26-
if (!(opens.indexOf(top) === closers.indexOf(symbol))) {
27-
balanced = false;
28-
}
2928
}
3029
index++;
3130
}

0 commit comments

Comments
 (0)