I'm trying to assign an iterator method to a variable, but I get the error 'Cannot convert undefined or null to object' when I try to run it.
Works:
test = [1][Symbol.iterator]();
test.next(); // Returns 1
Doesn't work
test = [1][Symbol.iterator];
test().next(); // Cannot convert undefined or null to object
Why would I get an error in the second case?