Example 1 — Official Samples
Count an empty list and a list of three numbers.
console.log(R.length([])); // 0
console.log(R.length([1, 2, 3])); // 3 How It Works
- Not null. Both values are real arrays, so Ramda moves on to the second check.
- Numeric length.
[].lengthis0and[1, 2, 3].lengthis3— both numbers. - Return it. Ramda hands back that number unchanged. The arrays are not modified.
