我可以看到很多地方使用了 console.log()
。谁能告诉我为什么使用它?
像这样,
function createCheckBox( idsToShow ) {
for( i = 0 ; i < 15 ; i++ ) {
console.log( idsToShow.indexOf('main' + i + '|' ) + ' ' + 'main' + i + '|' );
if( idsToShow != '' && idsToShow.indexOf('main' + i + '|' ) == -1 ) continue;
checkBoxs += "<li> <input type=\"checkbox\" id=\"main" + i + "\" value=\"Example" + i + "\" name=\"lbl"+ i +"\" /> <label id=\"lbl"+ i +"\">Example" + i + "</label></li>";
ids += 'main' + i + '|'; //is the check box id.
}
}
最佳答案
它将事情记录到调试控制台(它内置于许多浏览器(例如 Chrome 开发者工具)中,并在许多其他浏览器中作为扩展(例如 Firebug for Firefox)提供)
关于javascript - 为什么要使用 console.log?它有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6649384/