Skip to content

Commit 3be989a

Browse files
author
Robert Ross
authored
Update test.js
1 parent c9e1ddb commit 3be989a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

04-chapter-Stack/test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const {stack} = require('./index')
22

33
function checkBalancedExpression (e) {
44
const s = stack()
5-
let balanced = false
5+
let balanced = true
66

77
for (const key in e) {
88
if (e[key] === '(') {
@@ -13,11 +13,9 @@ function checkBalancedExpression (e) {
1313
}
1414
s.pop()
1515
}
16-
if (s.length() > 0) {
16+
}
17+
if (s.length() > 0) {
1718
balanced = false
18-
} else {
19-
balanced = true
20-
}
2119
}
2220
return balanced
2321
}

0 commit comments

Comments
 (0)