You can check a number is not equal to zero by if (n) {} or check empty string by if (!s) .... Of course, just use object literal for you map. :)
if (n) {}
if (!s) ...
map
The last statement should be return !stack.length.
return !stack.length
Bonus point: we can solve it shorter by using recursion and String replace method.
I wrote this way for code readability :)
Yes, that way is better for products. But the boundary between readability and cleaning is not always clear. :)
True that.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can check a number is not equal to zero by
if (n) {}
or check empty string byif (!s) ...
.Of course, just use object literal for you
map
. :)The last statement should be
return !stack.length
.Bonus point: we can solve it shorter by using recursion and String replace method.
I wrote this way for code readability :)
Yes, that way is better for products. But the boundary between readability and cleaning is not always clear. :)
True that.