GREAT! This is one word for this shorthand.

On Mon, Jan 23, 2012 at 9:11 PM, Narendra Sisodiya <
naren...@narendrasisodiya.com> wrote:

> Thanks !!
> Fantastic Suggestion !!
>
>
>
> On Mon, Jan 23, 2012 at 7:35 PM, Diego Perini <diego.per...@gmail.com>wrote:
>
>> Nice suggestion, it comes often handy and performance are surely better.
>>
>> It is possible to also use an "object" instead of an "array":
>>
>>    var a = ({ 0: false, 1: true })[index];
>>
>> this gives the same mapping with an "object" lookup instead.
>>
>> This let's you use both strings or numbers as indexes.
>>
>>
>> Diego
>>
>>
>> On Mon, Jan 23, 2012 at 1:33 PM, Narendra Sisodiya
>> <naren...@narendrasisodiya.com> wrote:
>> > var a;
>> > switch(num){
>> >
>> > case 0: a = false;
>> > case 1: a = true;
>> > }
>> >
>> > This whole process can be done via
>> >
>> > var a = [false,true][num];
>> >
>> > Like
>> > var a = ["Mon","Tues","Wed","Thurs","Fri","Sat","Sun"][num] + "day";
>> >
>> >
>> > --
>> > ┌─────────────────────────┐
>> > │    Narendra Sisodiya
>> > │    http://narendrasisodiya.com
>> > └─────────────────────────┘
>> >
>> > --
>> > To view archived discussions from the original JSMentors Mailman list:
>> > http://www.mail-archive.com/jsmentors@jsmentors.com/
>> >
>> > To search via a non-Google archive, visit here:
>> > http://www.mail-archive.com/jsmentors@googlegroups.com/
>> >
>> > To unsubscribe from this group, send email to
>> > jsmentors+unsubscr...@googlegroups.com
>>
>> --
>> To view archived discussions from the original JSMentors Mailman list:
>> http://www.mail-archive.com/jsmentors@jsmentors.com/
>>
>> To search via a non-Google archive, visit here:
>> http://www.mail-archive.com/jsmentors@googlegroups.com/
>>
>> To unsubscribe from this group, send email to
>> jsmentors+unsubscr...@googlegroups.com
>>
>
>
>
> --
> ┌─────────────────────────┐
> │    Narendra Sisodiya
> │    http://narendrasisodiya.com
> └─────────────────────────┘
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/jsmentors@jsmentors.com/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/jsmentors@googlegroups.com/
>
> To unsubscribe from this group, send email to
> jsmentors+unsubscr...@googlegroups.com
>



-- 
Regards
Anoop K. Gupta

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to