Valid Parentheses

Photo by David Gavi on Unsplash

Sometimes when your code doesn’t work, the problem might be as simple as haven’t invalid parentheses. Today’s Codewars challenge, which I tackle in JavaScript, addresses this very issue. Afterwards, you’ll be such a pro with parentheses, all your parentheses issues will be a thing of the past.

The kata is to write a function that takes a string of parentheses, and determines if the order of the parentheses is valid. The function should return true if the string is valid, and false if it’s invalid.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store