How to console log the name of a variable/function?

后端 未结 6 1461
梦谈多话
梦谈多话 2020-12-09 12:58

I want to do this: log(variableOrFunction)

And be able to produce this: variableOrFunction: actualValue.

I tried this:



        
6条回答
  •  误落风尘
    2020-12-09 13:31

    If “value” is of type Object. You can try console.dir(value) instead of the long console.log, and you should be able to see the Object tree key: value pairs in a better formate in the console

提交回复
热议问题