News for hackers. Stuff that matters.
Re:Be careful what you copy: Invisibly inserting usernames i... by codedokode on Wednesday April 04, 2018 @01:22AM (#16752182)

    const zeroPad = num => ‘00000000’.slice(String(num).length) + num;
What a bad way to declare a function. Starting with the word 'function' will make the code much more readable. Arrow functions are supposed to be used as a small callbacks, not to obfuscate the meaning of the code.
Re:Be careful what you copy: Invisibly inserting usernames i... by jacobolus on Wednesday April 04, 2018 @01:26AM (#16752197)
If you spend a few days reading code written in this style, you will quickly get used to it. This is not “obfuscated”, and there’s nothing wrong with using this syntax for general functions. (Personally, I would recommend putting the function body on the next line, but meh.) If you have any kind of reasonable text editor, you can add syntax highlighting or other visual call-outs for functions, if that is important to you.
Re:Be careful what you copy: Invisibly inserting usernames i... by hyper_reality on Wednesday April 04, 2018 @02:51AM (#16752564)
I was more confused by the parameter being named 'num' before having the String function called on it and its length taken - when in fact 'num' should be a binary string when it's passed into the function. But maybe I've been spoiled by strong types.
Re:Be careful what you copy: Invisibly inserting usernames i... by hodl on Thursday April 05, 2018 @03:15AM (#16762596)
The rightmost num is coerced. And the hole is finished on par.
Re:Be careful what you copy: Invisibly inserting usernames i... by vbezhenar on Wednesday April 04, 2018 @03:00AM (#16752613)
function keyword carries a lot of stuff: this variable, arguments variable, function name can be accidentally changed later. constant lambda is easier to understand.
Re:Be careful what you copy: Invisibly inserting usernames i... by hodl on Wednesday April 04, 2018 @05:43AM (#16753294)
I'm from Haskell. I love it.