- Read the "Challenge description" below.
- Make changes to the challenge.js file.
- Commit your changes.
- Wait for the result of the "GitHub Classroom Workflow" action. If it is green - congratulations, you solved this challenge! If not - try again!
- You can watch an example of how to solve a challenge in this video
There are 3 kinds of Brackets: [] {} (). Given a String of characters, check if all the brackets in the String are Balanced. A string is balanced if all the start and end brackets are in a correct order so they match each other. Here are some balanced Strings:
- {}
- (hello)[world]
- [({}{}{})([])]
Here are some Unbalanced ones:
- (hello - no ending )
- ([)] - The [ is improperly enclosed in the ().
- )( - There's an ending ) without a ( before it.
Return true if a line is balanced and false otherwise.
The following are 3 test cases:
console.log(balanced_brackets?('(hello)[world]'))
// => true
console.log(balanced_brackets?('([)]'))
// => false
console.log(balanced_brackets?('[({}{}{})([])]'))
// => true