JavaScript debugging by variable value

I’m wondering if it’s possible to debug JavaScript by searching on variable values.
For example, let’s say I don’t know how the code of a page works, but I know that a variable contains the name “John Smith”. Is it possible to find out what the variable in question is (or what attribute of what object, etc.)?

I tried thé différent options in Chrome and Firefox debugging modules, but couldn’t fond anyrhong helpful.