jQuery makeArray() methodAs the name implies, the makeArray() method is used to convert an array-like object into the true JavaScript array. It returns the array. SyntaxThis method accepts a single parameter, which is defined as follows - obj - It is any object to turn into a native array. Let's understand the working of the makeArray() method, using some illustrations. Example1In this example, we are using the makeArray() method to turn a collection of HTML elements into an array of items. We can use the isArray() method to check whether the elements are converted into an array or not. If the isArray() method returns true, the elements are converted into an array, otherwise not. We can also use the jQuery type() method to check the type of the variable arr. Test it NowOutput After the execution of the above code, the output will be - After clicking the given button, the output will be - Example2Here, we are using the makeArray() method to convert an array-like string arr into an array. The result of the conversion will be stored in the variable arr1. So, we are also using jQuery.type() method to check the type of the variable arr1. In the output, we can see that the type of the variable arr1 is written as an array, and the value of the string is also converted into an array. Test it NowOutput After the execution of the above code, the output will be - After clicking the given button, the output will be - Next TopicjQuery keypress() method |