Post

JavaScript
JavaScript@JavaScript·
Just curious, are you using => functions exclusively or still sticking to traditional function syntax? No judgement!
English
712
248
2.9K
0
Peter Girnus 🦅
Peter Girnus 🦅@gothburz·
@JavaScript Arrow functions since it’s neater especially if written on one line. 👨🏼‍💻
English
0
0
1
0
Marcel
Marcel@marcelkargul·
@JavaScript I use normal function syntax but for array methods and stuff i use arrow syntax as it looks a lot cleaner
English
0
0
1
320
jame
jame@kloogans·
@JavaScript arrow functions with good naming convention all day
English
0
0
1
0
Luis H. Ball Jr.
Luis H. Ball Jr.@luqven·
@JavaScript I now default to arrow functions instinctively but can’t say I “prefer” one over the other.
English
0
0
0
0
Harshit Anand
Harshit Anand@MrHAnand·
@JavaScript For callbacks, arrow function. For function declaration, normal function
English
2
2
29
0
Andrew Rowley
Andrew Rowley@internet_drew·
@JavaScript Starting to use them for any instance in which I don’t need to worry about what ‘this’ is bound to.
English
2
0
30
0
Priyanshu Lata
Priyanshu Lata@PriyanshuLata·
@JavaScript It takes me 5x more time to understand the syntax everytime I try to use that. Traditional function() is longer but more comfortable
English
0
0
20
0
TiiL
TiiL@MzTeel·
@JavaScript I dnt have a preference yet. I’m still fighting for my life learning the material. 🤣
English
0
0
13
0
Deniyi
Deniyi@deniyined·
@JavaScript I learnt the modern before i knew there was a traditional, lol
English
2
0
13
0
Tyler Smith
Tyler Smith@tylerlwsmith·
@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
0
0
11
0
DEVersity
DEVersity@DearDEVersity·
@JavaScript Depends on the circumstance. Anonymous functions use =>. If I want my reader to better understand the purpose of a function, I'll use traditional.
English
0
0
11
0
Mahmoud
Mahmoud@interakt_dev·
@JavaScript Does using one over the other make any difference to the code?
English
4
0
10
0
Web Guy Jeff
Web Guy Jeff@WebGuyJeff·
@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
1
0
10
0
Subhasis Das
Subhasis Das@inframarauder·
@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
0
0
7
0
JΛYDΞV the τεⅽʜ-ϰɪϰɟa
@JavaScript 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.
English
0
1
5
0
Colon :🦊:
Colon :🦊:@TheRealGDColon·
@JavaScript Arrows!! And any copy and pasted code from stackoverflow is getting arrow'd as well
English
1
0
7
0
Ryan
Ryan@Ryan90572886·
@JavaScript Arrow functions and function declarations have slightly different behavior, so it depends on the use case.
English
0
0
6
0
Atefeh
Atefeh@__Atefeh____·
@JavaScript Arrow functions all the way Becuse on this way i have no problem with this anymore😅
English
0
0
6
0
Cameron N
Cameron N@ccnokes·
@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
1
0
5
0
Kyriakos Markakis
Kyriakos Markakis@marquicodes·
@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
2
0
5
0
Saad Ahmad
Saad Ahmad@imsaadahmad·
@JavaScript Hey Js, It'd look cool if you add <= for return statements, coz => is used for functions. 🤌
English
0
1
3
0
drainpipe
drainpipe@drainpipe_·
@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
0
0
5
0
Mark Bokil
Mark Bokil@markbokil·
@JavaScript You can’t use arrow functions with hoisting so in those cases I use old school functions
English
1
0
5
0
Sijo Sam
Sijo Sam@mr_samdev·
@JavaScript Depends on the scope required of that function 😋
English
0
0
4
0
Teilen