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

My (newly discovered) favorite trick is using the comma operator. Using it, you can (admittedly horribly) log anything in the middle of any expression.

This for example will call `console.log(myVar)` and still call `someFunction(myVar, someOtherArgument)`.

  myVar = "12345"
  someFunction((console.log(myVar), myVar), someOtherArgument);
Pretty handy sometimes :)


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

Search: