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

后端 未结 5 1923
一个人的身影
一个人的身影 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:03

    When you call jQuery() you aren't passing any arguments to the function so it is returning an empty object. WHen you pass a selector as argument it creates an object of the elements that match the selector

提交回复
热议问题