Thread: New Ideas
View Single Post
  #13  
Old 07-24-2001, 04:14 AM
grim_squeaker_x grim_squeaker_x is offline
Retired Oldbie
grim_squeaker_x's Avatar
Join Date: Mar 2001
Posts: 3,084
grim_squeaker_x will become famous soon enough
Quote:
Originally posted by General
let me give you two pieces of code to show you
NPC Code:

//Code 1 - Functions take arguments
function happy(a,b) {
return a*b;
}
variable = happy(2,2);



NPC Code:

//Code 2 - No arguments
fucntion happy() {
this.return=a*b;
}
a=2;
b=2;
happy();
variable=this.return



in both cases variable winds up equaling 4...but notice how much shorter Code 1 is than code 2
Well yes, it can be done like that but something like this won't work as good with that:
NPC Code:
function multiplier(var1,var2) {
return var1*var2;
}
blah=1;
blahblah=2;
blahblahblah=3;
this.a=multiplier(blah,blahblah);
this.b=multiplier(blahblah,blahblahblah);


__________________

Reply With Quote