var fnName = function fnName...

16 views
Skip to first unread message

Morten Sjøgren

unread,
Oct 11, 2013, 6:08:09 AM10/11/13
to jsh...@googlegroups.com
I've seen the following code many times and find it to be rather poor coding style, is it possible to have jshint give a warning about it?

var fnName = function fnName( e ) {
   // do stuff
};

I don't think there is a good reason to write the function like that so I change it to the following every time I can.

var fnName = function( e ) {
   // do stuff
};

But I would like to get a warning about from jshint, is that possible?

- Morten

Anton Kovalyov

unread,
Oct 11, 2013, 2:18:25 PM10/11/13
to jsh...@googlegroups.com
The first style is useful when you want your stack traces to have real function names and not (anonymous). SpiderMonkey can figure it out the real name even without that but its a very recent addition. Not sure about other engines. 

Anton

--
You received this message because you are subscribed to the Google Groups "JSHint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jshint+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages