Function verifies whether string has wrong order of parentheses or not. I made two ways of solving this, normal using for loop, and functional using filter and reduce.
It also includes unit tests for both functions and you can see it online here: for-loop and functional. Here are performance tests comparing their speed.
The code syntax is based on ES6 and Standard.