Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use javascript for years and never come across a situation where you'd do or see several of the things found in that small statement.


I made that point in another thread as well, if you stick to the meat and gravy of JavaScript you just don't hit on these nuances of the languadge. I am generally not a fan of clever programming tricks or "magic code" and if you are then JavaScript becomes a tempest, but if you are using it to glue interfaces together, build some widgets and manage events you just don't get into the ugly side of JavaScript, it's not my favorite languadge but it get's the job done and it is efficient as far as development effort goes.


There are only 3 things, which aren't surprising to anyone who has done much js.

  1). a list of expressions eg (foo,bar,baz) evaluates to the last one.
  2). Array(4) creates an empty array of 4 elements
  2). Array(4).toString() = ",,,"


I don't think the comma operator wouldn't be surprising to an experienced js programmer. I can't remember a single piece of serious code where I could see it in use.

The same applies to the void operator, I can think of one or two cases at most where it would be useful, but I don't see anyone using it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: