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

后端 未结 11 1967
天涯浪人
天涯浪人 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 14:48

    So,. I had this issue,. except I got [object object]

    I'm sure you could do this with recursion but this worked for me:

    Here is what I did in my console:

    var object_that_is_not_shallow = $("all_obects_with_this_class_name");
    var str = '';
    object_that_is_not_shallow.map(function(_,e){
        str += $(e).html();
    });
    copy(str);
    

    Then paste into your editor.

提交回复
热议问题