How does a jQuery instance appear as an array when called in console.log?

后端 未结 5 1907
一个人的身影
一个人的身影 2021-01-03 15:58

When entered into a JavaScript console, a jQuery object appears as an array. However, it\'s still an instance of the jQuery object.

var j = jQuery();
=> [         


        
5条回答
  •  庸人自扰
    2021-01-03 16:21

    I think what you're trying to see are your object's properties. If that's the case, you're inadvertently converting the object into a string when you append it to another string. Use the , operator instead of + to show the object properties instead of the "stringified" version of the object:

    console.log('test with string concat: ', j);
    

提交回复
热议问题