Given following code:
const letters = ['a', 'b', 'c'];
foo = ((list, letter) => {
if (list.includes(letter)) {
return true;
}
return false;
})(letters, 'c') ? 'letter in list' : 'letter not in list';
console.log(foo);
Output will be:
letter in list
How does ternary operator work in this example? Does it call foo with letters
and c
as parameters? How does it know to call this function?