console.log showing contents of array object

后端 未结 7 1935
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 16:02

I have tried using console.log so I can see the content of my array that contains multiple objects. However I get an error saying console.log is not an

7条回答
  •  爱一瞬间的悲伤
    2021-01-30 16:42

    The console object is available in Internet Explorer 8 or newer, but only if you open the Developer Tools window by pressing F12 or via the menu.

    It stays available even if you close the Developer Tools window again until you close your IE.

    Chorme and Opera always have an available console, at least in the current versions. Firefox has a console when using Firebug, but it may also provide one without Firebug.

    In any case it is a save approach to make the use of console output optional. Here are some examples on how to do that:

    if (console) {
        console.log('Hello World!');
    }
    
    if (console) console.debug('value of someVar: ' + someVar);
    

提交回复
热议问题