Javascript / Chrome - How to copy an object from the webkit inspector as code

后端 未结 11 1931
天涯浪人
天涯浪人 2020-11-29 14:47

I am doing a console.log statement in my javascript in order to log a javascript object. I\'m wondering if there\'s a way, once that\'s done - to copy that object as javascr

11条回答
  •  再見小時候
    2020-11-29 15:03

    You can copy an object to your clip board using copy(JSON.stringify(Object_Name)); in the console.

    Eg:- Copy & Paste the below code in your console and press ENTER. Now, try to paste(CTRL+V for Windows or CMD+V for mac) it some where else and you will get {"name":"Daniel","age":25}

    var profile = {
        name: "Daniel",
        age: 25
    };
    
    copy(JSON.stringify(profile));
    

提交回复
热议问题