Basically after reading some parts of the source code of V8 (google chrome's javascript engine basically was doing that to improvise the way i code script) i figured a few things out . javascript is basically mantaining Associated Array stacks for each and every function / variable it has..
so whats the big thing ?
instead of of having a code like this
if(a=='b')
{ c.b()
}else if (a=='d')
{ c.d() }
else if (a=='e')
{ c.e()}
else if....// and so on
.. else{
c.default();
}Those who are familier with programming call this "If-else Ladder" which can be pretty time consuming to write..
Now instaead of writing a 100 lines of code if u have 100 functions inside it
simply call
c[b]() ; // yeas its that epic easy!
that 1 lines solves all the insanity of if - else laddder and thats not just it ...
you can aslo describe custom 'named' functions using a way like this:
var a = {} ; //Object with no properties
a['myfunc'] = function(params ) {
// do something
}That gives a programmer a lot of easy to play with other portions of his software then wasting time in typing the code whole day.
Hope this helps to the new javascripters ^_^.
Last edited by fanofcena (2011-08-19 05:21:06)
Offline
Offline
Wow, I feel like I've just met my long lost love.
[/geeksideofme]
Offline
ProgrammingFreak wrote:
Wow, I feel like I've just met my long lost love.
![]()
[/geeksideofme]
lolol. its basically a funny thing that javascript can be soooooooooooooooooo friendly for programmer i mean its as friendly as scratch (but gets typed and u cannot make a forever loop or it will crash the browser ** thoguh setinterval(xyz,100) ;** acts as an epic forever loop! )
Offline
fanofcena wrote:
ProgrammingFreak wrote:
Wow, I feel like I've just met my long lost love.
![]()
[/geeksideofme]lolol. its basically a funny thing that javascript can be soooooooooooooooooo friendly for programmer i mean its as friendly as scratch (but gets typed and u cannot make a forever loop or it will crash the browser ** thoguh setinterval(xyz,100) ;** acts as an epic forever loop! )
Offline
Do you mean
c.[a];
?
Offline
Nerds o_o
Offline
Dude, you just solved all known problems in the programming world.
I love you
Offline