Skip to content

About

Node.js Function: Looks for matching brackets {}; if true, returns -1, if false, returns the index of the first offending bracket.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Balanced Brackets

balancedForLoop.js - Checks for balanced brackets using a for loop. balancedPosition.js - Checks for balanced brackets and returns position and type of missing bracket. balancedReduce.js - Checks for balanced brackets using the reduce() method.

Examples

node balanced.js 'hello world'

node balanced.js '{}'

node balanced.js '{{{foo();}}}{}'

node balanced.js '{{}{}}'

node balanced.js '{{{}'

node balanced.js '}'

node balanced.js '{}{foo{}'

About

Node.js Function: Looks for matching brackets {}; if true, returns -1, if false, returns the index of the first offending bracket.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages