Find JavaScript function definition in Chrome

Lets say we’re looking for function named foo:

  1. (open Chrome dev-tools),
  2. Windows: ctrl + shift + F, or macOS:
    cmd + optn + F. This opens a window for searching across all scripts.
  3. check “Regular expression” checkbox,
  4. search for foo\s*=\s*function (searches for foo = function with any number of spaces between those three tokens),
  5. press on a returned result.

Another variant for function definition is function\s*foo\s*\( for function foo( with any number of spaces between those three tokens.

Leave a Comment