In the case I repeat the same identifier on a catch block I receive an "'identifier' is already defined" error message. try { } catch (exception) { } ... try {...
2958
Tom Worster
thefsb
Aug 8, 2012 12:46 am
Some compressors do not touch the initial comments of a file in order to leave copyright, license etc. in place. I find that useful. However, some of my files...
2959
aceblchboy
Aug 8, 2012 1:27 pm
... I believe the goal of this rule is to make it easier to identify exactly where the error is happening, and there's no shame in numbering. I also prefix...
2960
douglascrockford
douglascrock...
Aug 8, 2012 1:28 pm
... Could you be more sepecific?...
2961
Tom Worster
thefsb
Aug 8, 2012 1:53 pm
... Sure. I'd like to have a source code file that begins like this: /* Public copyright notice not to be compressed */ ; /* Code comments the compressor...
2962
Jakob Kruse
thekrucible
Aug 8, 2012 2:11 pm
This is very compressor specific, is it not? Both comments would be removed (regardless of your choice of snippet) by JSMin and YUI Compressor for instance,...
2963
sandyhead25
Aug 8, 2012 9:31 pm
I have found the following code works in both my Pretty Diff application and the JSLint tool: /*prettydiff.com api.topcoms: true*/ /*license here*/ var a;...
2964
Tom Worster
thefsb
Aug 8, 2012 10:54 pm
... i don't know. ... one redundant ; does not amount filling a source file with garbage code. tolerating it and the resulting JSList warning remains an...
2965
ormico
Aug 18, 2012 6:09 am
I posted this question on stackoverflow before I got access to this group. ...
2966
Felix E. Klee
feklee
Aug 18, 2012 7:44 am
... According to JSLint source code, in strict mode, the `undef` flag is set to `false: function use_strict() { if (next_token.string === 'use strict') { if...
2967
Felix E. Klee
feklee
Aug 18, 2012 9:30 am
Some thoughts: While in strict mode, variables need to be defined before being used, your code obviously *does not* violate that rule. So, in my opinion, what...
2968
Dav Glass
marionhdrider
Aug 23, 2012 4:19 pm
The "node" option specifies that __dirname and __filename are valid options, yet if you don't use the "nomen" option it will still error. Shouldn't the "nomen"...
2971
Martin Cooper
mfncooper
Aug 31, 2012 5:33 am
If I need to create an array with a specified length, and the length is a literal, JSLint is happy enough with this: var arr = new Array(50); If, however, the...
2972
Felix E. Klee
feklee
Aug 31, 2012 7:15 am
On Fri, Aug 31, 2012 at 7:33 AM, Martin Cooper <mfncooper@...> ... Oh. There does not even seem to be an option to (temporarily) turn off that warning....
2973
Joe Hansche
joeatrr
Aug 31, 2012 7:25 am
There are reasons for using array literal notation over class instantiation notation. Afaiui, it's due to the ability to override the "Array" constructor,...
2974
Felix E. Klee
feklee
Aug 31, 2012 7:49 am
... I assume that performance is the reason. But then it's probably a good idea to have an in depth look at how the optimizers in current JavaScript compilers...
2975
Alexandre Morgaut
morgaut_a
Aug 31, 2012 7:59 am
Yes there is a workaround, one that still respect JSLint guidelines You can fix the length without the array constructor, even with a dynamic value Just do: ...
2976
Joe Hansche
joeatrr
Aug 31, 2012 8:22 am
According to MDN that is not what actually happens: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length You can only...
2977
Arild Haugstad
arildmmh
Aug 31, 2012 8:45 am
When experimenting with the developer console in Chrome and FireBug in FireFox, the effects of the two methods appear to be *exactly* the same. While setting...
2978
Alexandre Morgaut
morgaut_a
Aug 31, 2012 9:57 am
... The MDN documentation is unfortunately not very clear on this page. It says that "the array still contain only 2 elements". It's true, as when you do "new...
2979
douglascrockford
douglascrock...
Aug 31, 2012 12:34 pm
... new Array is deeply confusing to people coming to JavaScript from other languages because JavaScript39;s arrays do not work as expected. Much of that...
2980
Martin Cooper
mfncooper
Aug 31, 2012 2:07 pm
... If I want to create, say, a separator line of 'len' dashes, I can do that really cleanly and easily with: var separator = Array(len).join('-'); If there's...
2981
Luke Page
page.luke...
Aug 31, 2012 2:25 pm
... Wouldn't it be clearer and more maintainable to create a function for it anyway? var seperator = repeatString('-', len); it doesn't look as "clever" to use...
2982
Alexandre Morgaut
morgaut_a
Aug 31, 2012 2:41 pm
... I think that it's more maintainable and more secure to use a dedicated function One going to the code using the Array constructor might expect that the...
2983
Martin Cooper
mfncooper
Aug 31, 2012 2:51 pm
... Right. So I personally find that taking advantage of what the language has to offer helps me do that. If I have to write a function, document it, and write...
2984
Tom Worster
thefsb
Aug 31, 2012 2:59 pm
... if a separator line is unlikely to be of variable length (which is probably so): var separator = '----------------------------------------'; looks good to...
2985
IcedNet Development T...
dwmcneil...
Aug 31, 2012 3:09 pm
You may not code for "noobs", but you will have new hires, and you will document that one-liner or have to explain it, even to professionals... Knowing how to...
2986
Martin Cooper
mfncooper
Aug 31, 2012 4:30 pm
On Fri, Aug 31, 2012 at 8:09 AM, IcedNet Development Team ... It's not supposed to be "clever". I am only trying to use a feature that exists in the language....
2987
IcedNet Development T...
dwmcneil...
Aug 31, 2012 4:50 pm
Please, you assume much Is it creating a new array of length 'len' and joining it to the string literal '-' ? -- and JSLint is supposed to make code clearer......
2989
John Hawkinson
john.hawkinson
Aug 31, 2012 11:58 pm
One of the problems I have with this discussion is that the cost of having to go read this repeatString() function, however it is implemented, is significant....