简体   繁体   English

如何在Chrome Devtools中找到匹配(关闭)JavaScript括号?

[英]Way to find matching (closing) JavaScript bracket in Chrome Devtools?

JavaScript newbie here. JavaScript新手在这里。 I'm reviewing a big swath of JS code using devtools and I'm wondering if there's an easy way to locate where the closing bracket is on a function. 我正在使用devtools审查一大堆JS代码,我想知道是否有一种简单的方法可以找到关闭括号在函数上的位置。 Is there a feature where I can highlight an opening bracket and pinpoint where the closing bracket is located? 是否有一个功能,我可以突出显示一个开口支架,并确定闭合支架的位置?

You can use a chrome devtool shortcut. 您可以使用chrome devtool快捷方式。 First move the cursor next to opening or closing bracket then do CTRL + m . 首先将光标移动到开始或结束括号旁,然后执行CTRL + m Note this also works for parenthesis and curly brackets. 请注意,这也适用于括号和大括号。

To see all the available shortcuts click on three dots icon at the top right side of devtools then click on Shortcuts . 要查看所有可用的快捷方式,请单击devtools右上角的三个点图标,然后单击Shortcuts

You should use the sources tab. 您应该使用sources选项卡。 It has few buttons in the footbar, which has pretty print which looks like this: {} which displays the formatted JS. 它在footbar中有很少的按钮,它有漂亮的打印,如下所示: {}显示格式化的JS。 When you put your cursor on a brace the other (closing or opening ) brace is automatically matched for you. 当您将光标放在支架上时,另一个(关闭或打开)支架会自动与您匹配。

For latest devtools in chrome, use chrome canary. 对于最新的镀铬工具,请使用镀铬金丝雀。

refer > https://developers.google.com/chrome-developer-tools/docs/javascript-debugging 参考> https://developers.google.com/chrome-developer-tools/docs/javascript-debugging

据我所知,他们在chrome dev工具中是不可能的,但是如果你将代码复制并粘贴到Notepad ++或Dreamweaver等程序中,并将光标放在其中一个括号的右侧,则相应的括号将突出显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM