New to javascript. I reused code from an in-house repository for an in-house tool. I see this function:
function getItemIndex(itemList, item) {
const isItemPresent = (items) => items[0] === item;
const itemIndex = itemList.findIndex(isItemPresent);
return itemIndex;
}
I do not understand how items
gets its value.
It is not sent in the function arguments. The entire file does not have any variable with the same name.
Can someone please explain how it works. Or point to the javascript concept related to this so that I can do further reading.
Arrow functions said about (parameter) => expression
. But this parameter is not defined anywhere from what I see.