MyttO
03-24-2005, 05:34 PM
Hi guys,
Isn't there a way to declare a function with paramters having default values
:confused: :confused:
Isn't there a way to declare a function with paramters having default values
:confused: :confused:
|
||||
Function with default paramater values?MyttO 03-24-2005, 05:34 PM Hi guys, Isn't there a way to declare a function with paramters having default values :confused: :confused: afru 03-24-2005, 05:45 PM Hi, JS doesnt have default Parameters option.... This is a work around... function someFunction(param1, param2,param3){ if(param1==null) param1="hello "; if(param2==null) param2="how "; if(param3==null) param3="are you?"; alert(param1+param2+param3); } someFunction("hi","how","is life"); someFunction("hi"); Afru. MyttO 03-24-2005, 05:56 PM In fact this is a workaround, but pretty elegant. What about function overloading as in some other modern languages, is it feasable? |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum