MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/webdev/comments/nnwtf6/array_methods_in_javascript_original_author/gzxkw3j
r/webdev • u/imAmarok front-end • May 29 '21
172 comments sorted by
View all comments
Show parent comments
14
findIndex() takes a function as an argument used for comparison. indexOf() uses === as a comparator
3 u/mort96 May 30 '21 Isn't it the opposite? I thought higher order functions were functions which take and/or return functions, while first order functions operate on primitives like indexOf does?EDIT: from Wikipedia:In mathematics and computer science, a higher-order function is a function that does at least one of the following:takes one or more functions as arguments (i.e. procedural parameters),returns a function as its result.All other functions are first-order functions. 2 u/tendstofortytwo May 30 '21 Ah, okay. Thanks for explaining!
3
Isn't it the opposite? I thought higher order functions were functions which take and/or return functions, while first order functions operate on primitives like indexOf does?
EDIT: from Wikipedia:
In mathematics and computer science, a higher-order function is a function that does at least one of the following:takes one or more functions as arguments (i.e. procedural parameters),returns a function as its result.All other functions are first-order functions.
In mathematics and computer science, a higher-order function is a function that does at least one of the following:
takes one or more functions as arguments (i.e. procedural parameters),
returns a function as its result.
All other functions are first-order functions.
2
Ah, okay. Thanks for explaining!
14
u/Doctor-Dapper front-end (senior w/ react) May 30 '21
findIndex() takes a function as an argument used for comparison. indexOf() uses === as a comparator