On Feb 24, 2012, at 11:24, Dean Landolt wrote: > On Fri, Feb 24, 2012 at 12:12 PM, Christopher Jeffrey wrote: > >> On Feb 23, 1:29 pm, Dean Landolt wrote: >> >>> var arr = [ "foo", >>> , "bar", >>> , "baz" >>> ] >>> >>> Did you spot the error right away? Neither did Brendan Eich. But a linter >>> would have. >> >> Know what else would have spotted that error? A javascript >> implementation. The first time you run that code, v8 would spit out an >> error and give you the exact line number before it's even finished >> parsing. What's the point of a linter there? > > Wow, you sound pretty confident.
By which you're trying to say that in fact it is valid JavaScript code, but it does not produce the result the author probably intended -- it produces an array with some holes or undefined values in it. $ node > var arr = [ "foo", ... , "bar", ... , "baz" ... ] undefined > arr [ 'foo', , 'bar', , 'baz' ] For the record, yes, I did immediately spot the problem with the code when you posted it -- it was easy to see because there are peculiar commas at the beginnings of some lines. Removing them fixes the problem. To express the counterpoint to the one already made earlier by others, it would never occur to most people to put commas at the beginnings of lines like that so they immediately stand out as being incorrect. I don't care if you put commas (or semicolons) at the beginning or end of lines. It's a matter of style. Do whatever makes you happy. It makes me happy to put them at ends of lines, so that's what I do. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en