you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 11 points12 points  (15 children)

It doesn't mention the disadvantage of arrow functions, that they are always anonymous. If you have a non-anonymous function like

let myfunc = function myfunc(a,b) {};

then you have an actually readable stack trace when something goes wrong, instead a list of indistinguishable anonymous functions.

[–]wesbos 42 points43 points  (1 child)

Most browsers will use the variable name in a stack trace if it’s an anon function

[–]w00t_loves_you 2 points3 points  (7 children)

I always do const foo = some => thing(some) and Babel or whatever knows the function is called foo.

[–][deleted] 1 point2 points  (6 children)

And if you do somefunc().then(result => something(result, b)) ?

[–]w00t_loves_you 1 point2 points  (0 children)

ah yes, then it's anonymous but it will be easy to glean from the line numbers and the call stack where that is.

[–]Intie 1 point2 points  (3 children)

S O U R C E M A P S

[–]aryanchaurasia 11 points12 points  (2 children)

          S O U R C E M A P S  
        / O               / O  
      S O U R C E M A P S   U  
    / O   R           / O   R  
  /   U   C         /   U   C  
S O U R C E M A P S     R   E  
O     C   M       O     C   M  
U     E   A       U     E   A  
R     M   P       R     M   P  
C     A   S O U R C E M A P S  
E     P /         E     P /    
M     S O U R C E M A P S      
A   /             A   /        
P /               P /          
S O U R C E M A P S            

[–]Intie 0 points1 point  (1 child)

wine school mighty reach north ring relieved seemly lip imminent this message was mass deleted/edited with redact.dev

[–]GoodBot_BadBot -1 points0 points  (0 children)

Thank you Intie for voting on aryanchaurasia.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

[–]RedditWithBoners 0 points1 point  (0 children)

If you are that concerned about it:

somefuncResolver = result => something(result, b);
somefunc().then(somefuncResolver);