jQuery inArray() method Last Updated : 31 Jul, 2024 Comments Improve Suggest changes Like Article Like Report This inArray() Method in jQuery is used to search for a specific value in an array and return its index (or -1 if not found). SyntaxjQuery.inArray(val, arr [, Index])Parameters The inArray() method accepts three parameters that are described below: val: The value to search in an array.arr: Any array like object.Index: Index of the array from which to begin search.Return ValueIt returns the index of element in an array, or -1 if element not found. Example 1: In this example, the inArray() method searches an element 30 in the array. HTML <!DOCTYPE HTML> <html> <head> <title> jQuery inArray() Method </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"> </script> </head> <body> <script> let arr = [10, 20, 30, 40, 50, 60]; let val = 30; let index = $.inArray(val, arr); console.log(index); </script> </body> </html> Console Output:2Example 2: In this example, the inArray() method searches an element 30 in the array. The index attribute is also passed to search the element from index 3 and return -1. HTML <!DOCTYPE HTML> <html> <head> <title> jQuery inArray() Method </title> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"> </script> </head> <body> <script> let arr = [10, 20, 30, 40, 50, 60]; let val = 30; let index = $.inArray(val, arr, 3); console.log(index); </script> </body> </html> Output:-1 Comment More infoAdvertise with us Next Article jQuery inArray() method P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JQuery jQuery-Methods Similar Reads JQuery | isArray() method This isArray() Method in jQuery is used to determines whether the argument is an array. Syntax: jQuery.isArray( object ) Parameters: The isArray() method accepts only one parameter that is mentioned above and described below: object : This parameter is the object to test whether or not it is an arra 2 min read JQuery | isFunction() method This isFunction() Method in jQuery is used to determines if its argument is callable as a function. Syntax: jQuery.isFunction( value ) Parameters: The isFunction() method accepts only one parameter that is mentioned above and described below: value : This parameter is the value to be tested. Return 2 min read JQuery map() Method This map() Method in jQuery is used to translate all items in an array or object to a new array of items. Syntax: jQuery.map( array/object, callback )Parameters: This method accepts two parameters which are mentioned above and described below: array/object: This parameter holds the Array or object t 2 min read ES6 | Array filter() Method The Array filter() is an inbuilt method, this method creates a new array with elements that follow or pass the given criteria and condition. Few Examples have been implemented below for a better understanding of the concept Syntax: var newArray = arr.filter(callback(element[, index[, array]]) [, thi 2 min read Lodash _.isArray() Method Lodash _.isArray() method checks if the given value can be classified as an Array Value or not.Syntax:_.isArray(value);Parameters:value: This parameter holds the value that needs to be Checked for an Array.Return Value: This method returns a Boolean value.Example 1: In this example, we are checking 2 min read Like