There are reasons for using array literal notation over class instantiation notation. Afaiui, it's due to the ability to override the "Array" constructor,...
... 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...
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: ...
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...
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...
... 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...
... 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...
... 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...
... 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...
... 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...
... 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...
... if a separator line is unlikely to be of variable length (which is probably so): var separator = '----------------------------------------'; looks good to...
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...
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....
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......
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....
i just think JSLint isn't for everyone. i had been using it with greater or lesser enthusiasm for years until, after watching the video of douglas' talk at...
Hey Tom, That TXJS11 talk was great wasn't it! http://vimeo.com/25606006 If you can switch off the emotional side of your brain, the logic is very hard to...
That code gives a strict violation (due to presence of `this`): function f() { 'use strict'; return this.x; } That code doesn't: var f = function () { 'use...
Hi, I have a module which toggles two group of event handlers : // structure (function () { "use strict"; function a() {} function b() {} function c() {b(c);...
(function () { "use strict"; var a, b, c, d; a = function () {}; b = function () {}; c = function () {b(c); a(d); }; d = function () {b(a); a(c); }; c(); d(); ...
Erik Meijer talking about the hazards and other interesting things. http://channel9.msdn.com/posts/Erik-Meijer-Functional-Programming-From-First-Principles...
Whilst reviewing some code, I spotted an unnecessary use of call and it stood out to me as a good candidate for a warning. The following code demonstrates the...
I expect jslint to accept the following two-line code snippet, but instead it gives the error "Unexpected '['". What am I doing wrong? ===JSLINT INPUT=== var a...