Chrome/Firefox console.log always appends a line saying 'undefined'

前端 未结 7 1658
时光说笑
时光说笑 2020-11-21 13:40

Every time console.log is executed, a line saying undefined is appended to the output log.

It happens in both Firefox and Chrome on Windows

相关标签:
7条回答
  • 2020-11-21 14:24

    What you can do is simply create your own console.log like function with a return to change this behavior when doing a lot of coding in the developer console. Here is an example of what that looks like in the developer console:

    console.log('I hate seeing the next line stating the obvious.')
    I hate seeing the next line stating the obvious.
    undefined
    log = function(l){return l}
    function log()
    if(1 === 2){console.log('1 is not equal to 2.')}else{log('No Shit Sherlock.')}
    "No Shit Sherlock."
    
    0 讨论(0)
提交回复
热议问题