Returns the length of an iterable. If the iterable has a length property (like arrays), uses that property. Otherwise, counts all elements in the iterable.
The iterable to get the length of
The number of elements in the iterable
G.length([1, 2, 3]); // 3 (uses array.length)G.length(new Set([1, 2, 3])); // 3 (uses Set.size)G.length(G.range(1, 5)); // 4 (counts generator elements) Copy
G.length([1, 2, 3]); // 3 (uses array.length)G.length(new Set([1, 2, 3])); // 3 (uses Set.size)G.length(G.range(1, 5)); // 4 (counts generator elements)
count - For counting elements without checking for length property
Returns the length of an iterable. If the iterable has a length property (like arrays), uses that property. Otherwise, counts all elements in the iterable.