Post

@JavaScript I sometimes like old ones for hoisting or inline util functions
English

@JavaScript Arrow functions since it’s neater especially if written on one line. 👨🏼💻
English

@JavaScript Lambdas are faster but less readable. It depends!
English

@JavaScript I use normal function syntax but for array methods and stuff i use arrow syntax as it looks a lot cleaner
English

@JavaScript I now default to arrow functions instinctively but can’t say I “prefer” one over the other.
English

@JavaScript Starting to use them for any instance in which I don’t need to worry about what ‘this’ is bound to.
English

@JavaScript I dnt have a preference yet. I’m still fighting for my life learning the material. 🤣
English

@JavaScript I default to the "function" keyword for most things.
Hoisting is helpful for module-level functions. For inline callback functions/closures, I like that the function keyword allows me to give the function a descriptive name.
English

@JavaScript Does using one over the other make any difference to the code?
English

@JavaScript Both, because it's required - they aren't equal. One such example of where arrow functions catch me out, is in event listener callbacks. Arrow functions don't bind 'this', which can lead to debugging hell when I forget 😁
English

@JavaScript Arrow functions because I like that functions are just values.
English

@JavaScript Mostly fat arrow (=>) functions. The only time I use traditional functions(function()) is when I need the scope of 'this' to be the function itself, instead of global scope. I guess that's a major difference between the two approaches that really sets apart their use cases.
English

@JavaScript `function` keyword for everything but one-liners and inline functions (e.g callbacks on array methods, etc). The function keyword is plenty terse and the hoisting behavior is useful.
I'm also positive this is the only correct opinion to have 😁.
English

@JavaScript Probably quite unpopular but I prefer the traditional function syntax:
function doSomething (x, y) { ... }
I use arrow functions mostly for one liners and some trivial callbacks.
English

@JavaScript For tiny bits of code where the absence of 𝚝𝚑𝚒𝚜 isn't an inconvenience, sure.
As a wholesale replacement for using the 𝚏𝚞𝚗𝚌𝚝𝚒𝚘𝚗 keyword, no I am not interested in trying to look cool by making everything a variable assignment.
English

@JavaScript Mostly arrow functions for callbacks definitely...
English

@JavaScript I like to take advantage of the hoisting behavior available with traditional functions
English

@JavaScript utility functions are mostly traditional for me... but member functions are always arrow syntax as I don't want the burden of binding scope.
English

@JavaScript This is rather funny bc i just decided to make the switch to => yesterday! However it almost feels to clean lol
English

@JavaScript Both of them! I use more => functions when I'm coding in React.js and inside functions wrote in traditional syntax. I love => functions! 😁
English

@JavaScript Yes! Use => when you want to pass the "this" context from caller to function.
No if that function is ever used outside that context.
English

@JavaScript Arrow functions are more than just syntax sugar. That being said they are my go to way to write a function unless an occasion calls for me to use the original syntax.
English

@JavaScript `function` tells the reader that the line contains a function declaration, var/let/const doesn't until you keep reading.
I only use arrows if I need a one-liner or to bind `this` to its lexical context, otherwise, you're adding noise to the code IMO.
English

@JavaScript I use a mix of both. When its a short one I will use an arrow function to keep it compact and cleaner when I have more going on I opt for a traditionally defining function
English












