This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-08-19 05:02:45

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

JavaSCRIPT programmers must see.

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

Code:

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

Code:

  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:

Code:

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)


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#2 2011-08-19 15:08:06

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: JavaSCRIPT programmers must see.

^_^ bump@


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#3 2011-08-19 15:10:19

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: JavaSCRIPT programmers must see.

koolio
cept
i got no idea wutdafungus it meanz

Offline

 

#4 2011-08-19 15:43:49

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: JavaSCRIPT programmers must see.

777w wrote:

koolio
cept
i got no idea wutdafungus it meanz

xpctd that .. lol


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#5 2011-08-19 16:58:26

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: JavaSCRIPT programmers must see.

yikes  Wow, I feel like I've just met my long lost love.  lol
[/geeksideofme]

Offline

 

#6 2011-08-19 17:35:04

recycle49
Scratcher
Registered: 2009-12-21
Posts: 1000+

Re: JavaSCRIPT programmers must see.

yikes  Woah. Just started learning. Wow


"Every challenge must be met, every battle must be won, and every story will end." -Me
Recycle49 December 09 - November 11 Goodbye

Offline

 

#7 2011-08-20 01:30:44

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: JavaSCRIPT programmers must see.

ProgrammingFreak wrote:

yikes  Wow, I feel like I've just met my long lost love.  lol
[/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! )


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#8 2011-08-20 02:21:22

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: JavaSCRIPT programmers must see.

I approve of this post.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#9 2011-08-20 06:55:16

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: JavaSCRIPT programmers must see.

fanofcena wrote:

ProgrammingFreak wrote:

yikes  Wow, I feel like I've just met my long lost love.  lol
[/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! )

tongue

Offline

 

#10 2011-08-22 07:06:11

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: JavaSCRIPT programmers must see.

Do you mean

c.[a];

?

Offline

 

#11 2011-08-22 11:53:42

fanofcena
Scratcher
Registered: 2008-07-03
Posts: 1000+

Re: JavaSCRIPT programmers must see.

scimonster wrote:

Do you mean

c.[a];

?

NO c[a] for javascript an object is an associative array!


http://i53.tinypic.com/2vxr2c0.png Click whats above u might make a cute planet happy ^_^

Offline

 

#12 2011-08-22 13:52:02

peterkap
Scratcher
Registered: 2009-01-24
Posts: 1000+

Re: JavaSCRIPT programmers must see.

Nerds o_o   lol

Offline

 

#13 2011-08-22 15:28:35

throughthefire
Scratcher
Registered: 2009-07-09
Posts: 1000+

Re: JavaSCRIPT programmers must see.

Dude, you just solved all known problems in the programming world.
I love you


Back. For now. Maybe.

Offline

 

#14 2011-08-22 20:05:22

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: JavaSCRIPT programmers must see.

Oh god. Wow.

Nice job discovering it!  big_smile

Thanks.  big_smile


Hai.

Offline

 

Board footer