What is your most unusual javascript concept you've ever seen ?
Posted
by
Cybrix
on Programmers
See other posts from Programmers
or by Cybrix
Published on 2011-02-02T15:18:58Z
Indexed on
2011/02/16
15:33 UTC
Read the original article
Hit count: 258
Hi,
I've learned javascript at school but since I'm working with it and study about it every day, I've found very particular aspect of javascript that I didn't know about. Which at first, was very hard to understand for me and finally, I found it very usefull and easy to implement. And in the final, it gives to my code some kind of "beauty".
An example I've once seen:
function getter( input )
{
result = {
foo1 : 'bar1',
foo2 : 'bar2',
foo3 : 'bar3'
}[input] || input || "default";
return result;
}
Do you guys have other examples of particular use you make of Javascript ?
Thank you
PS: I use the term particular use because it might be unusual for any Javascript beginner. I believe this question is most likely to belong to the community wiki.
© Programmers or respective owner