Just curious, are you using => functions exclusively or still sticking to traditional function syntax? No judgement!


I sometimes like old ones for hoisting or inline util functions


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


I use both, but prefer =>


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


arrow functions with good naming convention all day


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


For callbacks, arrow function. For function declaration, normal function


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


It takes me 5x more time to understand the syntax everytime I try to use that. Traditional function() is longer but more comfortable


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


I learnt the modern before i knew there was a traditional, lol


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.


Depends on the circumstance. Anonymous functions use =>. If I want my reader to better understand the purpose of a function, I'll use traditional.


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


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 😁


Arrow functions because I like that functions are just values.


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.


When passing a #JavaScript function as an argument, its better to use the phatarrow syntax. Inside of a class, or global scope, its better for writing an "easy 2 use & understand lexical scope", and for printing better stacktraces to use the C-Style functions.


Arrow functions and function declarations have slightly different behavior, so it depends on the use case.


`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 😁.


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.


Hey Js, It'd look cool if you add <= for return statements, coz => is used for functions. 🤌


arrow function all the time ❤️. Even in our product FansZila ( fanszila.com )


You can’t use arrow functions with hoisting so in those cases I use old school functions


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


Traditional function syntax user here... 🥹


Depends on the scope required of that function 😋


Traditional functions feels original lol


Mostly arrow functions for callbacks definitely...


Arrow functions all the way


United States الاتجاهات
Loading...

Something went wrong.


Something went wrong.