问题
I can't seem to find a way to add a watch expression for the selected JavaScript text in Chrome developer tools, the same way I would in Firebug with Ctrl+W. Is there really no way to do this in Chrome? I can't even right-click the selection as it unselects as soon as I do it, and there is no "Add watch" context menu item. Do I really have to type in every watch I want to add while debugging JS?
回答1:
You can do it by clicking 'add to watch' after right clicking
You can also select the expression/variable and hit Ctrl + Shift + A
回答2:
According to Chrome DevTool Docs - Watch variables in Sources, you can do it in 1 of 3 ways:
- Highlight text, right click and choose "Add selected text to watches"
- Note: this used to be "Add to watch"
- Highlight text and press Ctrl + Shift + A
- Add from the watch panel directly in the top right corner of the sources tab

回答3:
You need to double click the variable name, then right click will reveal the add to watch option.
来源:https://stackoverflow.com/questions/27247350/how-to-add-watch-in-chrome-developer-tools