Web Development Ninjas Question:

Tell me what is $() in jQuery library?

Tweet Share WhatsApp

Answer:

The $() function is an alias of jQuery() function, at first it looks weird and makes jQuery code cryptic, but once you get used to it, you will love it’s brevity. $() function is used to wrap any object into jQuery object, which then allows you to call various method defined jQuery object. You can even pass a selector string to $() function, and it will return jQuery object containing an array of all matched DOM elements. I have seen this jQuery asked several times, despite it’s quite basic, it is used to differentiate between developer who knows jQuery or not.

Download Ninjas Web Developer PDF Read All 58 Ninjas Web Developer Questions
Previous QuestionNext Question
Tell me why did you decide to enter the world of gaming? How long have you been creating games?Explain me what is the each() function in jQuery? How do you use it?