Trans Woman - She/Her/Hers - EN / FR - Software engineer, musician, language nerd, monster movie connoisseur, pottymouth. - I know more about Godzilla than you do.
I have a lot of opinions about JS style that might a bit uncommon or idiosyncratic
var > let > const
{letx=1;// let for block level vars}constpi=3.14;// const for string/num constantsvary=3;// var for everything else
Double quotes for strings, always
varyes="good";varno='bad';
Space before function parens in declaration, no space before invocation
functionfoo(){}foo();
ONLY use arrow function when you require lexical this, and NEVER (well, almost never) use anonymous functions. Also, no arrow functions without curlies (I make exception for simple pluck operations because I'm lazy).
[1,2,3].map(functiontimesTwo(num){returnnum*2;});vartimesMultiplier=(num)=>{returnnum*this.multiplier;};[1,2,3].map(timesMultiplier);userAPI.getUser().then(usr=>usr.id);// this is fine I guess
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have a lot of opinions about JS style that might a bit uncommon or idiosyncratic
var > let > const
Double quotes for strings, always
Space before function parens in declaration, no space before invocation
ONLY use arrow function when you require lexical this, and NEVER (well, almost never) use anonymous functions. Also, no arrow functions without curlies (I make exception for simple pluck operations because I'm lazy).