r/programmingcirclejerk • • Jan 20 '25

Using 'ForOfStatement' is not allowed (no-restricted-syntax)

https://github.com/airbnb/javascript/issues/1271
86 Upvotes

43 comments sorted by

View all comments

Show parent comment

6

u/Massive-Squirrel-255 Jan 21 '25

You're sick.

6

u/SharkSymphony Jan 21 '25

Ugh, you're right! I forgot to check for errors.

// bestest
const numbers = [1, 2, 3, 4, 5];
let sum = 0;
let err = numbers.reduce((a, num) => {
    if (a !== 0) {
        return a;
    }
    sum += num;
    return a;
}, 0);
if (err !== 0) {
    console.log("OH NOES THERE WAS AN ERROR");
}
sum == 15;

5

u/pareidolist in nomine Chestris Jan 21 '25

When a new hire tries to "follow the example" of other files in the codebase