“如果调试"在JavaScript中? [英] "if debug" in JavaScript?
本文介绍了“如果调试"在JavaScript中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JavaScript或Visual Studio中是否有任何东西可以检测代码是否在调试模式下使用?类似于C#中的"#if DEBUG",但适用于JavaScript吗?
解决方案
否.
#if
/ #endif
是C#(和其他语言)的预处理程序指令,告诉编译器在编译时有条件地包括/排除一部分代码.>
JavaScript是一种未经预编译的脚本语言,因此具有这样的预处理器指令没有多大意义.
Is there anything in JavaScript or Visual Studio to detect if the code is used in debug-mode? Something like "#if DEBUG" in C#, but for JavaScript?
解决方案
No.
#if
/#endif
are preprocessor directives in C# (and other languages) that tells the compiler to conditionally include/exclude a section of code when compiling.
JavaScript is a script language that is not precompiled, and therefore it would not make much sense to have preprocessor directives like these.
这篇关于“如果调试"在JavaScript中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文