We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7309191 commit dee0191Copy full SHA for dee0191
src/js/others/balanced-symbols.js
@@ -17,15 +17,14 @@ export function parenthesesChecker(symbols) {
17
} else if (stack.isEmpty()) {
18
balanced = false;
19
} else {
20
- // makes sure the stack isn't empty.
21
if (!stack.isEmpty()) {
22
top = stack.pop();
+ if (!(opens.indexOf(top) === closers.indexOf(symbol))) {
23
+ balanced = false;
24
+ }
25
} else { // error case
26
27
}
- if (!(opens.indexOf(top) === closers.indexOf(symbol))) {
- balanced = false;
28
- }
29
30
index++;
31
0 commit comments