Assign console.log value to a variable

后端 未结 5 742
青春惊慌失措
青春惊慌失措 2020-12-25 13:56

How can I assign a JavaScript object to a variable which was printed using console.log?

I am in Chrome console. With Ruby I would use test = _

5条回答
  •  借酒劲吻你
    2020-12-25 14:41

    If you want to do this to an object that has been already logged (one time thing), chrome console offers a good solution.

    Hover over the printed object in the console, right click, then click on "Store as Global Variable". Chrome will assign it to a temporary var name for you which you can use in the console.

提交回复
热议问题