@jay: The goal is to determine Parity, -not necessarily color rows. @Michael: Is there any benefit to the two liner over the almost exactly same one liner you wrote?
I'm re-writing the post to be more "How to get Parity" and less "How to color rows". On May 31, 8:59 am, Slik Jay <[email protected]> wrote: > http://jsfiddle.net/Jm2Hb/19/ > > On Mon, May 31, 2010 at 6:29 PM, Michael Ficarra > > <[email protected]> wrote: > > "" (an empty string) is a falsy value. I think the original poster of > > the one-line version believed as I did that the nil function the OP > > was using was determining falsiness (which is pretty useless in the > > original use case). I created a fast two-liner (http://jsfiddle.net/ > > Jm2Hb/18/) that should allow you to whitelist any falsy values by OR- > > ing them in the ternary condition. > > > Michael > > > On May 31, 9:55 am, rasmusfl0e <[email protected]> wrote: > >> How would you get ""/"odd" back as even/odd using that one liner? > > >> "" || "even" would return "even" > > >> On May 31, 2:56 pm, Michael Ficarra <[email protected]> > >> wrote: > > >> > A slightly faster one-liner:http://jsfiddle.net/Jm2Hb/9/ > > >> > Use &1 to check the last bit. It's faster than modding, especially for > >> > larger numbers. > > >> > On May 31, 4:09 am, eskimoblood <[email protected]> wrote: > > >> > > Btw, your parity method could be an one liner: return this%2 ? odd || > >> > > 'odd' : even || 'even';http://jsfiddle.net/Jm2Hb/8/ > > >> > > On May 31, 5:09 am, Aaron Newton <[email protected]> wrote: > > >> > > > > 2. stop feeling guilty about being a leach every time I read Arron > >> > > > > Newton write "... or start a blog ..." > > >> > > > I think you're the first. Welcome to my cabal.
