DEV Community 👩‍💻👨‍💻

Discussion on: Daily Challenge #51 - Valid Curly Braces

Collapse
jasman7799 profile image
Jarod Smith • Edited on
// validateBraces :: String -> Bool
const validateBraces = braces => braces ? [...braces.trim()]
  .filter(char => char === '{' || char === '}')
  .map(brace => brace === '{'? brace = 1 : -1)
  .reduce((sum, value) => sum < 0 ? false : sum += value) === 0: 'No Braces'