This project is read-only.

$linq(...).indexOf is not a function


I'm using jslinq.js but there is no such method like indexOf() so when I tried to use it, it hit this error.

file attachments


battousai999 wrote Jan 12 at 7:49 AM

Actually, $linq does have an "indexOf" function that takes a predicate function as a parameter and returns the (0-based) index of the first element that satisfies the predicate. There is also an "indexOfElement" function that returns the (0-based) index of the first element that matches the value passed into the "indexOfElement" function. See the documentation for these functions at (

All that aside, if you are experiencing some issue with calling the "indexOf" method, feel free to respond with some example code that demonstrates the error you're receiving.

abhayin wrote Jan 13 at 8:17 AM

Have a look at the pictures that I've shared
indexOf method is not listing.

battousai999 wrote Jan 13 at 6:33 PM

Can you insert the following lines of code immediately before the line of code on which the error occurs (they list out the functions on the $linq object prototype)?
var _ta = []; var _a = $linq(tempArry); for(var p in _a) { if (typeof _a[p] === 'function') _ta.push(p); }; console.log(_ta);
var _tta = linq.isArray(tempArry); console.log(_tta);
What gets logged to the console (after these lines of code are executed)? I'm guessing that "indexOf" will not be listed, but I'm curious about how else it differs from the expected prototype of the linq object.

Also, can you attach (to this issue) the copy of the jslinq.js file (or jslinq.min.js file) that this code is using? Thanks.