Mismatched parentheses: a quick way to find them?

I just rearranged a very large JavaScript file. I now get “Unexpected end of input.” Somewhere in those hundred of functions, one has lost (or gained) a bracket. What’s the quickest way to find it?

  • Curly Brackets in Arrow Functions
  • JavaScript regex get all numbers but exclude all between brackets
  • Rules for the use of angle brackets in Typescript
  • get all inner brackets/parentheses
  • JavaScript: comma after opening bracket of parameter in syntax example
  • Understanding the Context of Curly Brackets '{}'
  • get all inner brackets/parentheses
  • Fix Sublime Text 2 brackets matching with > 28 if()-tests?
  • difference between dot notation and bracket notation in javascript
  • JavaScript regex get all numbers but exclude all between brackets
  • What is this JavaScript construct: “ = [y for each …]”
  • Rules for the use of angle brackets in Typescript
  • 4 Solutions collect form web for “Mismatched parentheses: a quick way to find them?”

    You could try to parse your file with lint:
    http://www.javascriptlint.com/online_lint.php

    If you have problems with the size of the file try to split it into smaller ones…

    A good trick when missing a brace in eclipse is to go to the final brace in the source module and double-click it. That will highlight all the way back to what it THINKS is the matching open brace. Where it highlights back to is invariably the START of where the problem is, so skip that open brace and go to the next one and start double-clicking open braces and you will usually find where the brace is missing pretty quickly. I learnt that the hard way with a source code file of 20,000+ lines of code and getting hundreds of errors without the slightest indication as where the real problem was as the errors started appearing thousands of lines earlier in the code.

    Re-format the file using something that indents well. Look for something that’s too far to the left.

    Minimize the nesting of functions. It reduces the quality of the code (maintainability-wise).