On Mon, Feb 9, 2009 at 4:45 PM, Eric Garside <gars...@gmail.com> wrote:

>
> Not really, ternary operators work fine for most situations. This is
> designed for a much more variable approach. Imagine a case where you
> want to conditionally call different functions based on the state.
>
> $('div').cond(settings.use_thumbnails, 'createThumb').cond
> (settings.use_image_security, 'createScreen',
> settings.screen_opacity);
>

You can still use ternary operations when you need a dynamic method as well:

$("div")[condition ? "addClass" : "removeClass"]("myClass");

-Dan

Reply via email to