Forum Discussion

itaykaldi's avatar
itaykaldi
Contributor
13 years ago

Default value for method

Hey, 

i want to use defualt value for method, but i got error:

the method:



function FindRowByCellText (Grid, View, ColumnId, Text, StartRowHandle = 0)

{

....

}



how do i write default value?



10x.





1 Reply

  • Hello itay,



    In JavaScript, for those cases I usually use this line inside the method:



    StartRowHandle = typeof StartRowHandle == "undefined" ? 0 : StartRowHandle;



    So, if you don't set the parameter value, it will take 0 as default value; otherwise, it will take the value provided.



    I hope it helped