如何在运行时修改javascript代码? [英] How to modify javascript code at run time?

查看:134
本文介绍了如何在运行时修改javascript代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调试时是否可以修改JavaScript代码? Visual Studio具有编辑并继续功能,可以用Java和其他语言完成类似的代码热交换。可以使用JavaScript完成吗?如果可以,怎么做?

Is there a way to modify JavaScript code while debugging? Visual Studio has "Edit and Continue", and similar hot swapping of code can be done in Java and other languages. Can this be done with JavaScript, and if so, how?

推荐答案

Chrome,Safari和其他基于WebKit的浏览器在Web检查器中包含一项称为实时编辑的功能。如果您转到脚本面板并在断点处停止(或者即使没有在断点处停止-我不确定),则可以双击一行并开始编辑该行。您所做的更改将在脚本上生效。

Chrome, Safari, and some other WebKit-based browsers contain a feature in the Web Inspector known as Live Edit. If you go to the Scripts panel and are stopped on a breakpoint (or maybe even if not stopped on a breakpoint — I'm not sure), you can double click on a line and start editing that line. The changes you make will take effect on the script.

这篇关于如何在运行时修改javascript代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆