• 0 Posts
  • 38 Comments
Joined 3 years ago
cake
Cake day: June 13th, 2023

help-circle











  • I’ve worked at several places that didn’t have formatters when I started. they did by the time I left. you can incrementally adopt them and if it’s automated most people at worst don’t care. advocate for things you want

    reassignment and hoisting are the significant ones. behavior around this does just seem more intuitive than otherwise when it comes up, so I think telling especially new devs to use const arrow fn everywhere but classes is a reasonable rule

    hate to break it to you but it behaves like a variable either way. function just behaves closer to a var variable. const fns are less like variables since no assignment. intellisense/devtools all show them just fine. it really is just a minor aesthetic difference on the definition



  • semicolons? quotes? use a formatter and don’t think about it. I think js world has basically done this already.

    const is simpler. why would I declare an array as let if I’m not reassigning? someone can look at it and know they don’t have to think about reassignment of the reference, just normal mutation. ts has the further readonly to describe the other type of mutation, don’t abuse let to mean that.

    const arrow over named function? gets rid of all the legacy behaviors and apis. no arguments, consistent this, and no hoisting or accidental reassignment. the 2 places you should ever use named fn are generator or if you actually need this