Opened 12 years ago
Closed 12 years ago
#8878 closed enhancement (invalid)
jquery grep documentation
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | web | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
the jquery grep page documentation seems to indicate that the original array is modified and does not specify if the function returns an array. The original array is not modified and it returns the result.
var a = [-1,0,1,2]; var b = $.grep( a, function(n,i){ return n > 0; }); console.log(a) // [-1,0,1,2] console.log(b) // [1,2]
Change History (3)
comment:1 Changed 12 years ago by
Component: | unfiled → web |
---|---|
Owner: | set to [email protected]… |
Priority: | undecided → low |
Status: | new → pending |
comment:2 Changed 12 years ago by
Status: | pending → new |
---|
Sorry I missed that in the documentation. Also, I had remembered seeing someplace the return type of the function and parameters for the callback. And it's in the header, of course I missed that as well for some reason.
(e.g. jQuery.grep( array, function(elementOfArray, indexInArray), [ invert ] ) Returns: Array )
Thanks for your attention to detail that I seem to be lacking today.
To answer your question, and bow out gracelessly, I read "The $.grep() method removes items from an array as necessary..."
Thanks.
comment:3 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
From the grep documentation:
also with respect to your comments on the function returning an array:
Is there some specific text which you find to be misleading or which could be improved upon?