Example 1 — Official Number Check
Is the number in the list? The first two samples from the Ramda docs.
console.log(R.includes(3, [1, 2, 3])); // true
console.log(R.includes(4, [1, 2, 3])); // false How It Works
- Value first. The number to find comes before the list.
- Found.
3is at index 2, so the answer istrue. - Not found. No item equals
4, so the answer isfalse. - Always a boolean. You never get an index or the item back — use
R.indexOffor that.
