var debugging = true;var whichimage = "widget";if( debugging )alert( "calls swapimage() with argument: " + whichimage );var swapstatus = swapimage( whichimage );if( debugging )alert( "exits swapimage() with swapstatus=" + swapstatus );
检查alert()的内容和顺序,您可以非常容易地检查程序的健康状况。
以上就是如何在我的javascript代码中添加调试代码?的详细内容。