5 ms·
> Edit 2: I have been cursing the lack of multiple returns this week. It is a pain returning a hash/object or an array. Why is that? let rational = (a, b) =
by espadrine 12y ago
> Edit 2: I have been cursing the lack of multiple returns this week. It is a pain returning a hash/object or an array.
Why is that?
let rational = (a, b) => [a, b];
let [numerator, denominator] = rational(38, 4);
let reduced = rational(numerator/2, denominator/2);
PS. The above code works in stable Firefox.
- BugBrother 12y ago>> Why is that? <Cough> Obviously because I'm blind? :-) Thanks.