console.log() called on object other than console

后端 未结 1 2094
忘掉有多难
忘掉有多难 2021-02-11 16:55

I remember that always when I wanted to pass console.log as a callback parameter to some function, it didn\'t work unless I used the bind() method to b

1条回答
  •  无人及你
    2021-02-11 17:35

    Editor's Draft of Console API used to say:

    Logging APIs SHOULD all be callable functions allowing them to be passed as arguments to error handling callbacks, forEach methods, etc.

    This is no longer included in the current version of the specification.

    I thought that Chrome and Node.js changed it to work like in the specification, but it seems that it worked like that even before it.

    I'm still curious when did it change and what was the reason of that.

    0 讨论(0)
提交回复
热议问题